pub struct Clients(/* private fields */);server only.Expand description
Registry of connected relay clients.
This type manages the collection of active client connections and handles routing messages between them.
Implementations§
Source§impl Clients
impl Clients
Sourcepub async fn shutdown(&self)
pub async fn shutdown(&self)
Shuts down all connected clients.
This method gracefully disconnects all active client connections managed by this registry. It will wait for all clients to complete their shutdown before returning.
Sourcepub fn register<S>(&self, client_config: Config<S>, metrics: Arc<Metrics>)where
S: BytesStreamSink + Send + 'static,
pub fn register<S>(&self, client_config: Config<S>, metrics: Arc<Metrics>)where
S: BytesStreamSink + Send + 'static,
Builds the client handler and starts the read & write loops for the connection.
Once the client disconnects, the OnDisconnectGuard set in config will be dropped,
allowing callers to be notified of the disconnect.
Sourcepub fn disconnect(
&self,
endpoint_id: EndpointId,
connection_id: Option<ConnectionId>,
) -> bool
pub fn disconnect( &self, endpoint_id: EndpointId, connection_id: Option<ConnectionId>, ) -> bool
Disconnects connections registered for endpoint_id.
With Some(connection_id), disconnects only that connection (active or
an inactive duplicate). With None, disconnects every connection for the
endpoint. Returns true if a matching connection was found, or false
otherwise.
Shutdown happens asynchronously: each per-connection actor exits its run loop and unregisters itself after this call returns.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Clients
impl !RefUnwindSafe for Clients
impl Send for Clients
impl Sync for Clients
impl Unpin for Clients
impl !UnwindSafe for Clients
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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