pub struct RiConnectionPool {
pub active_connections: usize,
pub failed_connections: usize,
pub total_errors: usize,
/* private fields */
}Expand description
Connection pool for managing device connections with lifecycle and health monitoring
Fields§
§active_connections: usizeNumber of active connections
failed_connections: usizeNumber of failed connections
total_errors: usizeTotal number of errors
Implementations§
Source§impl RiConnectionPool
impl RiConnectionPool
Sourcepub fn new(
max_connections: usize,
connection_timeout: Duration,
health_check_interval: Duration,
) -> Self
pub fn new( max_connections: usize, connection_timeout: Duration, health_check_interval: Duration, ) -> Self
Creates a new connection pool
Sourcepub fn add_connection(&mut self, device_id: String, address: String)
pub fn add_connection(&mut self, device_id: String, address: String)
Adds a new connection to the pool
Sourcepub fn remove_connection(&mut self, connection_id: &str) -> bool
pub fn remove_connection(&mut self, connection_id: &str) -> bool
Removes a connection from the pool
Sourcepub fn get_connection(&self, connection_id: &str) -> Option<&RiConnectionInfo>
pub fn get_connection(&self, connection_id: &str) -> Option<&RiConnectionInfo>
Gets connection information
Sourcepub fn update_activity(&mut self, connection_id: &str) -> bool
pub fn update_activity(&mut self, connection_id: &str) -> bool
Updates connection activity
Sourcepub fn update_health_metrics(
&mut self,
connection_id: &str,
success: bool,
response_time_ms: f64,
) -> bool
pub fn update_health_metrics( &mut self, connection_id: &str, success: bool, response_time_ms: f64, ) -> bool
Updates connection health metrics
Sourcepub fn perform_health_check(&mut self)
pub fn perform_health_check(&mut self)
Performs health check on all connections
Sourcepub fn active_connections(&self) -> usize
pub fn active_connections(&self) -> usize
Gets the number of active connections
Sourcepub fn idle_connections(&self) -> usize
pub fn idle_connections(&self) -> usize
Gets the number of idle connections
Sourcepub fn unhealthy_connections(&self) -> usize
pub fn unhealthy_connections(&self) -> usize
Gets the number of unhealthy connections
Sourcepub fn get_statistics(&self) -> RiConnectionPoolStatistics
pub fn get_statistics(&self) -> RiConnectionPoolStatistics
Gets overall connection pool statistics
Trait Implementations§
Source§impl Clone for RiConnectionPool
impl Clone for RiConnectionPool
Source§fn clone(&self) -> RiConnectionPool
fn clone(&self) -> RiConnectionPool
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RiConnectionPool
impl RefUnwindSafe for RiConnectionPool
impl Send for RiConnectionPool
impl Sync for RiConnectionPool
impl Unpin for RiConnectionPool
impl UnsafeUnpin for RiConnectionPool
impl UnwindSafe for RiConnectionPool
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
Mutably borrows from an owned value. Read more
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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request