protosocket_rpc/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//! Protosocket RPC
//!
//! This crate provides an rpc-style client and server for the protosocket
//! protocol. You can use whatever encoding you want, but you must provide both a
//! `Serializer` and a `Deserializer` for your messages. If you use `prost`,
//! you can use the `protosocket-prost` crate to provide these implementations.
//! See example-proto for an example of how to use this crate with protocol buffers.
//!
//! Messages must provide a `Message` implementation, which includes a `message_id`
//! and a `control_code`. The `message_id` is used to correlate requests and responses,
//! while the `control_code` is used to provide special handling for messages. You can
//! receive Cancel when an rpc is aborted, and End when a streaming rpc is complete.
//!
//! This RPC client is medium-low level wrapper around the low level protosocket crate,
//! adding a layer of RPC semantics. You are expected to write a wrapper with the functions
//! that make sense for your application, and use this client as the transport layer.
//!
//! Clients and servers handle RPC cancellation.
//!
//! Clients and servers need to agree about the request and response semantics. While it is
//! supported to have dynamic streaming/unary response types, it is recommended to instead
//! use separate rpc-initiating messages for streaming and unary rpcs.

mod error;
mod message;

pub mod client;
pub mod server;

pub use error::{Error, Result};
pub use message::{Message, ProtosocketControlCode};