Add more docs
This commit is contained in:
@@ -28,12 +28,17 @@ type Inner = Box<
|
||||
+ 'static,
|
||||
>;
|
||||
|
||||
/// A default batteries included `transport` channel.
|
||||
///
|
||||
/// This provides a fully featured http2 gRPC client based on [`hyper::Client`]
|
||||
/// and `tower` services.
|
||||
#[derive(Clone)]
|
||||
pub struct Channel {
|
||||
svc: Buffer<Inner, Request<BoxBody>>,
|
||||
}
|
||||
|
||||
impl Channel {
|
||||
/// Create a [`Builder`] that can create a [`Channel`].
|
||||
pub fn builder() -> Builder {
|
||||
Builder::new()
|
||||
}
|
||||
@@ -77,6 +82,8 @@ impl Builder {
|
||||
}
|
||||
}
|
||||
|
||||
/// Set the buffer size for when the inner client applies back pressure and
|
||||
/// can no longer accept requests. Defaults to `1024`.
|
||||
pub fn buffer(&mut self, size: usize) -> &mut Self {
|
||||
self.buffer_size = size;
|
||||
self
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
//! TODO: write transport docs.
|
||||
|
||||
mod channel;
|
||||
pub mod channel;
|
||||
pub mod server;
|
||||
|
||||
mod endpoint;
|
||||
mod error;
|
||||
mod server;
|
||||
mod service;
|
||||
mod tls;
|
||||
|
||||
|
||||
@@ -25,15 +25,27 @@ use tower_service::Service;
|
||||
type BoxService = tower::util::BoxService<Request<Body>, Response<BoxBody>, crate::Error>;
|
||||
type Interceptor = Arc<dyn Layer<BoxService, Service = BoxService> + Send + Sync + 'static>;
|
||||
|
||||
/// A default batteries included `transport` server.
|
||||
///
|
||||
/// This is a wrapper around [`hyper::Server`] and provides an easy builder
|
||||
/// pattern style [`Builder`]. This builder exposes easy configuration parameters
|
||||
/// for providing a fully featured http2 based gRPC server. This should provide
|
||||
/// a very good out of the box http2 server for use with tonic but is also a
|
||||
/// reference implementation that should be a good starting point for anyone
|
||||
/// wanting to create a more complex and/or specific implementation.
|
||||
#[derive(Debug)]
|
||||
pub struct Server {}
|
||||
pub struct Server {
|
||||
_p: ()
|
||||
}
|
||||
|
||||
impl Server {
|
||||
/// Create a new [`Builder`] that can configure a Server.
|
||||
pub fn builder() -> Builder {
|
||||
Builder::new()
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Default)]
|
||||
pub struct Builder {
|
||||
tls: Option<(Vec<u8>, Vec<u8>)>,
|
||||
@@ -46,6 +58,7 @@ impl Builder {
|
||||
Default::default()
|
||||
}
|
||||
|
||||
/// Add a tls cert.
|
||||
pub fn tls(&mut self, pem: Vec<u8>, key: Vec<u8>) -> &mut Self {
|
||||
self.tls = Some((pem, key));
|
||||
self
|
||||
|
||||
Reference in New Issue
Block a user