Add more docs

This commit is contained in:
Lucio Franco
2019-09-23 17:09:20 -04:00
parent cccc008366
commit 95576f24c9
3 changed files with 24 additions and 3 deletions
+7
View File
@@ -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
+3 -2
View File
@@ -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;
+14 -1
View File
@@ -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