pub struct ConnectionManager { /* private fields */ }Expand description
Connection manager service
Implementations§
Source§impl ConnectionManager
impl ConnectionManager
pub fn new(timeout_duration: Duration, max_connections: usize) -> Self
Sourcepub async fn register_connection(
&self,
session_id: SessionId,
) -> Result<(), DomainError>
pub async fn register_connection( &self, session_id: SessionId, ) -> Result<(), DomainError>
Register a new connection
Sourcepub async fn update_activity(
&self,
session_id: &SessionId,
) -> Result<(), DomainError>
pub async fn update_activity( &self, session_id: &SessionId, ) -> Result<(), DomainError>
Update connection activity
Sourcepub async fn update_metrics(
&self,
session_id: &SessionId,
bytes_sent: usize,
bytes_received: usize,
) -> Result<(), DomainError>
pub async fn update_metrics( &self, session_id: &SessionId, bytes_sent: usize, bytes_received: usize, ) -> Result<(), DomainError>
Update connection metrics
Sourcepub async fn set_stream(
&self,
session_id: &SessionId,
stream_id: StreamId,
) -> Result<(), DomainError>
pub async fn set_stream( &self, session_id: &SessionId, stream_id: StreamId, ) -> Result<(), DomainError>
Associate stream with connection
Sourcepub async fn close_connection(
&self,
session_id: &SessionId,
) -> Result<(), DomainError>
pub async fn close_connection( &self, session_id: &SessionId, ) -> Result<(), DomainError>
Close connection
Sourcepub async fn remove_connection(
&self,
session_id: &SessionId,
) -> Result<(), DomainError>
pub async fn remove_connection( &self, session_id: &SessionId, ) -> Result<(), DomainError>
Remove connection completely
Sourcepub async fn get_connection(
&self,
session_id: &SessionId,
) -> Option<ConnectionState>
pub async fn get_connection( &self, session_id: &SessionId, ) -> Option<ConnectionState>
Get connection state
Sourcepub async fn get_active_connections(&self) -> Vec<ConnectionState>
pub async fn get_active_connections(&self) -> Vec<ConnectionState>
Get all active connections
Sourcepub async fn check_timeouts(&self) -> Vec<SessionId>
pub async fn check_timeouts(&self) -> Vec<SessionId>
Check for timed out connections
Sourcepub async fn process_timeouts(&self)
pub async fn process_timeouts(&self)
Process timeout check iteration (to be called by infrastructure layer)
Sourcepub async fn get_statistics(&self) -> ConnectionStatistics
pub async fn get_statistics(&self) -> ConnectionStatistics
Get connection statistics
Auto Trait Implementations§
impl Freeze for ConnectionManager
impl !RefUnwindSafe for ConnectionManager
impl Send for ConnectionManager
impl Sync for ConnectionManager
impl Unpin for ConnectionManager
impl !UnwindSafe for ConnectionManager
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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