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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
extern crate bytes;
extern crate crossbeam_channel;
extern crate rand;
extern crate tokio;
#[cfg(feature = "tracing")]
mod tracing;
#[cfg(feature = "tracing")]
macro_rules! mark_trace {
($trace:expr, $name:ident) => {
$crate::mark!($trace, $name)
};
}
#[cfg(not(feature = "tracing"))]
macro_rules! mark_trace {
($trace:expr, $name:ident) => {};
}
mod client;
mod network;
mod server;
pub type Result<T> = std::io::Result<T>;
pub use client::Client;
pub use network::Network;
pub use server::Server;
#[cfg(feature = "tracing")]
pub use tracing::Trace;
struct RpcOnWire {
client: ClientIdentifier,
#[allow(dead_code)]
server: ServerIdentifier,
service_method: String,
request: RequestMessage,
reply_channel: futures::channel::oneshot::Sender<Result<ReplyMessage>>,
#[cfg(feature = "tracing")]
trace: tracing::TraceHolder,
}
pub type RequestMessage = bytes::Bytes;
pub type ReplyMessage = bytes::Bytes;
pub type ServerIdentifier = String;
pub type ClientIdentifier = String;
#[cfg(test)]
mod test_utils;