pub struct UdsRpcServer { /* private fields */ }Expand description
A UnixListener-backed RPC server for the same-host ipc plane.
Implementations§
Source§impl UdsRpcServer
impl UdsRpcServer
Sourcepub fn new<P: IrohRequestProcessor>(
listener: UnixListener,
processor: P,
signing_key: SigningKey,
) -> Self
pub fn new<P: IrohRequestProcessor>( listener: UnixListener, processor: P, signing_key: SigningKey, ) -> Self
Build a server over an already-bound [UnixListener].
Sourcepub fn with_capacity(
listener: UnixListener,
processor: Arc<dyn IrohRequestProcessor>,
signing_key: SigningKey,
stream_limit: usize,
) -> Self
pub fn with_capacity( listener: UnixListener, processor: Arc<dyn IrohRequestProcessor>, signing_key: SigningKey, stream_limit: usize, ) -> Self
Build a server with an explicit server-wide concurrent-stream cap.
Sourcepub fn with_connection_limit(self, limit: usize) -> Self
pub fn with_connection_limit(self, limit: usize) -> Self
Override the concurrent-connection cap (builder style).
Sourcepub fn with_stream_limit(self, limit: usize) -> Self
pub fn with_stream_limit(self, limit: usize) -> Self
Override the server-wide concurrent-stream cap (builder style).
Sourcepub fn with_read_timeout(self, read_timeout: Duration) -> Self
pub fn with_read_timeout(self, read_timeout: Duration) -> Self
Override the per-stream request-read timeout (#159). Primarily for tests.
Sourcepub fn with_rpc_config(self, cfg: &RpcConfig) -> Self
pub fn with_rpc_config(self, cfg: &RpcConfig) -> Self
Apply all tunables from an super::rpc_session::RpcConfig in one call (#197).
Sourcepub fn shutdown_token(&self) -> CancellationToken
pub fn shutdown_token(&self) -> CancellationToken
A handle that, when cancelled, stops the accept loop and per-connection
serve loops. Does not by itself drain in-flight streams — use
UdsRpcServer::shutdown for a graceful drain.
Sourcepub fn stream_limit(&self) -> Arc<Semaphore> ⓘ
pub fn stream_limit(&self) -> Arc<Semaphore> ⓘ
The shared concurrent-stream semaphore (pair with UdsRpcServer::capacity
UdsRpcServer::shutdown_tokento drain whilerunownsself).
Sourcepub async fn shutdown(
stream_limit: &Arc<Semaphore>,
capacity: u32,
token: &CancellationToken,
)
pub async fn shutdown( stream_limit: &Arc<Semaphore>, capacity: u32, token: &CancellationToken, )
Graceful shutdown: cancel the accept loop, then wait (bounded by
DRAIN_TIMEOUT) for every in-flight stream to release its permit, then
close the semaphore. Mirrors QuinnRpcServer::shutdown.
Sourcepub async fn shutdown_until(
stream_limit: &Arc<Semaphore>,
capacity: u32,
token: &CancellationToken,
deadline: Instant,
)
pub async fn shutdown_until( stream_limit: &Arc<Semaphore>, capacity: u32, token: &CancellationToken, deadline: Instant, )
Drain against the owner’s shared deadline, without starting a new grace.
Sourcepub async fn run(self) -> Result<()>
pub async fn run(self) -> Result<()>
Run the accept loop until shutdown is cancelled. Each accepted
connection is served on its own task by serve_rpc_connection, sharing
the server-wide [Semaphore] so UdsRpcServer::shutdown can drain
every in-flight stream regardless of which connection it belongs to.
Auto Trait Implementations§
impl !Freeze for UdsRpcServer
impl !RefUnwindSafe for UdsRpcServer
impl Send for UdsRpcServer
impl Sync for UdsRpcServer
impl Unpin for UdsRpcServer
impl UnsafeUnpin for UdsRpcServer
impl !UnwindSafe for UdsRpcServer
Blanket Implementations§
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<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