Struct TtrpcServer
pub struct TtrpcServer { /* private fields */ }ttrpc only.Expand description
A ttRPC server as a rama Service: it serves one
ServerConnection per accepted stream, so it can be handed straight to a rama
listener (rama-tcp, rama-unix, …) instead of writing the per-connection loop by hand.
For a single, already-established connection (e.g. one virtual stream of an NRI mux),
use the lower-level ServerConnection directly instead.
Implementations§
§impl TtrpcServer
impl TtrpcServer
pub fn new() -> TtrpcServer
pub fn new() -> TtrpcServer
Create a new, empty TtrpcServer.
pub fn with_max_concurrent_streams(self, max: usize) -> TtrpcServer
pub fn with_max_concurrent_streams(self, max: usize) -> TtrpcServer
Set the maximum number of concurrently-executing request handlers per connection. Past
this, requests are rejected with RESOURCE_EXHAUSTED. Defaults to
DEFAULT_MAX_CONCURRENT_STREAMS.
pub fn set_max_concurrent_streams(&mut self, max: usize) -> &mut TtrpcServer
pub fn set_max_concurrent_streams(&mut self, max: usize) -> &mut TtrpcServer
Set the maximum number of concurrently-executing request handlers per connection. Past
this, requests are rejected with RESOURCE_EXHAUSTED. Defaults to
DEFAULT_MAX_CONCURRENT_STREAMS.
pub fn with_close_connection_on_oversized_frame(
self,
enabled: bool,
) -> TtrpcServer
pub fn with_close_connection_on_oversized_frame( self, enabled: bool, ) -> TtrpcServer
Treat an oversized inbound frame as a fatal protocol error: close the connection
(failing all its in-flight calls) instead of the default Go-parity behaviour of
discarding the payload and answering that stream with RESOURCE_EXHAUSTED
(containerd/ttrpc channel.go). Opt in for untrusted peers, where reading up to
~4 GiB of declared garbage per bad frame is wasted work.
pub fn set_close_connection_on_oversized_frame(
&mut self,
enabled: bool,
) -> &mut TtrpcServer
pub fn set_close_connection_on_oversized_frame( &mut self, enabled: bool, ) -> &mut TtrpcServer
Treat an oversized inbound frame as a fatal protocol error: close the connection
(failing all its in-flight calls) instead of the default Go-parity behaviour of
discarding the payload and answering that stream with RESOURCE_EXHAUSTED
(containerd/ttrpc channel.go). Opt in for untrusted peers, where reading up to
~4 GiB of declared garbage per bad frame is wasted work.
pub fn register(self, service: impl Service) -> TtrpcServer
pub fn register(self, service: impl Service) -> TtrpcServer
Register a (generated) ttRPC service’s methods on this server.
Trait Implementations§
§impl Clone for TtrpcServer
impl Clone for TtrpcServer
§fn clone(&self) -> TtrpcServer
fn clone(&self) -> TtrpcServer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Default for TtrpcServer
impl Default for TtrpcServer
§fn default() -> TtrpcServer
fn default() -> TtrpcServer
§impl<IO> Service<IO> for TtrpcServerwhere
IO: Io,
impl<IO> Service<IO> for TtrpcServerwhere
IO: Io,
§async fn serve(
&self,
stream: IO,
) -> Result<<TtrpcServer as Service<IO>>::Output, <TtrpcServer as Service<IO>>::Error>
async fn serve( &self, stream: IO, ) -> Result<<TtrpcServer as Service<IO>>::Output, <TtrpcServer as Service<IO>>::Error>
§fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
Auto Trait Implementations§
impl !RefUnwindSafe for TtrpcServer
impl !UnwindSafe for TtrpcServer
impl Freeze for TtrpcServer
impl Send for TtrpcServer
impl Sync for TtrpcServer
impl Unpin for TtrpcServer
impl UnsafeUnpin for TtrpcServer
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more