1mod client;
5mod conversions;
6mod node_provider;
7pub mod pool;
8#[cfg(with_server)]
9mod server;
10pub mod transport;
11
12pub use client::*;
13pub use conversions::*;
14pub use node_provider::*;
15#[cfg(with_server)]
16pub use server::*;
17
18pub mod api {
19 tonic::include_proto!("rpc.v1");
20}
21
22#[derive(thiserror::Error, Debug)]
23pub enum GrpcError {
24 #[error("failed to connect to address: {0}")]
25 ConnectionFailed(#[from] transport::Error),
26
27 #[error("failed to execute task to completion: {0}")]
28 Join(#[from] futures::channel::oneshot::Canceled),
29
30 #[error("failed to parse socket address: {0}")]
31 SocketAddr(#[from] std::net::AddrParseError),
32
33 #[error(transparent)]
34 InvalidUri(#[from] tonic::codegen::http::uri::InvalidUri),
35
36 #[cfg(with_server)]
37 #[error(transparent)]
38 Reflection(#[from] tonic_reflection::server::Error),
39}
40
41const MEBIBYTE: usize = 1024 * 1024;
42pub const GRPC_MAX_MESSAGE_SIZE: usize = 16 * MEBIBYTE;
43
44pub const GRPC_CHUNKED_MESSAGE_FILL_LIMIT: usize = GRPC_MAX_MESSAGE_SIZE * 7 / 10;