Skip to main content

gonzalo_proto/
lib.rs

1//! Shared gRPC schema for the gonzalo daemon. The generated module mirrors
2//! the `gonzalo.v1` package; payloads are JSON-encoded `gonzalo-core` types.
3
4pub mod http;
5
6pub mod v1 {
7    // tonic generates every service method as
8    // `Result<Response<T>, tonic::Status>`, and `Status` is wide enough to trip
9    // clippy 1.99's `result_large_err` (18 hits). This is build-script output,
10    // so there is nothing here to edit and the type is upstream's choice. The
11    // allow is scoped to the generated module alone, so hand-written code in
12    // this crate is still linted.
13    #![allow(clippy::result_large_err)]
14
15    tonic::include_proto!("gonzalo.v1");
16}
17
18pub use v1::{
19    DeleteRequest, DeleteResponse, GetRequest, GetResponse, GraphLocatedResponse,
20    GraphNamesResponse, GraphQueryRequest, ListRequest, ListResponse, PurgeRequest, PurgeResponse,
21    PutRequest, PutResponse,
22    gonzalo_client::GonzaloClient,
23    gonzalo_server::{Gonzalo, GonzaloServer},
24};
25
26/// Default ceiling for a single blob transferred over the daemon, in bytes
27/// (64 MiB). Shared by the server (HTTP body limit + gRPC decode limit) and the
28/// client (gRPC decode limit) so both agree on the supported blob size. The
29/// daemon may raise its own limit via `GONZALO_MAX_BLOB_SIZE`, but a client
30/// still caps decoding at this constant (see gonzalo#184 design ยง4).
31pub const DEFAULT_MAX_BLOB_SIZE: usize = 64 * 1024 * 1024;
32
33#[cfg(test)]
34mod tests {
35    #[test]
36    fn default_max_blob_size_is_64_mib() {
37        assert_eq!(super::DEFAULT_MAX_BLOB_SIZE, 67_108_864);
38    }
39}