pub struct ConnectionPool { /* private fields */ }Expand description
A pool of connections to multiple Talos endpoints.
The pool maintains connections to multiple Talos nodes and routes requests to healthy endpoints based on the configured load balancing strategy.
Implementations§
Source§impl ConnectionPool
impl ConnectionPool
Sourcepub async fn new(config: ConnectionPoolConfig) -> Result<Self>
pub async fn new(config: ConnectionPoolConfig) -> Result<Self>
Create a new connection pool.
§Errors
Returns an error if no endpoints are provided or if initial connection fails.
Sourcepub async fn get_client(&self) -> Result<TalosClient>
pub async fn get_client(&self) -> Result<TalosClient>
Get a healthy client using the configured load balancing strategy.
§Errors
Returns an error if no healthy endpoints are available.
Sourcepub fn get_healthy_endpoints(&self) -> Vec<String>
pub fn get_healthy_endpoints(&self) -> Vec<String>
Get a list of healthy endpoint URLs.
Sourcepub fn get_endpoint_health(
&self,
endpoint: &str,
) -> Option<&Arc<EndpointHealth>>
pub fn get_endpoint_health( &self, endpoint: &str, ) -> Option<&Arc<EndpointHealth>>
Get health information for an endpoint.
Sourcepub fn get_all_health(&self) -> &HashMap<String, Arc<EndpointHealth>>
pub fn get_all_health(&self) -> &HashMap<String, Arc<EndpointHealth>>
Get health information for all endpoints.
Sourcepub async fn health_check(&self, endpoint: &str) -> Result<bool>
pub async fn health_check(&self, endpoint: &str) -> Result<bool>
Sourcepub async fn health_check_all(&self)
pub async fn health_check_all(&self)
Perform health checks on all endpoints.
Sourcepub async fn record_success(&self, endpoint: &str)
pub async fn record_success(&self, endpoint: &str)
Record a successful operation for an endpoint.
Sourcepub async fn record_failure(&self, endpoint: &str)
pub async fn record_failure(&self, endpoint: &str)
Record a failed operation for an endpoint.
Sourcepub fn is_shutdown(&self) -> bool
pub fn is_shutdown(&self) -> bool
Check if the pool is shut down.
Sourcepub async fn connected_count(&self) -> usize
pub async fn connected_count(&self) -> usize
Get the number of connected clients.
Sourcepub fn endpoint_count(&self) -> usize
pub fn endpoint_count(&self) -> usize
Get the total number of endpoints.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ConnectionPool
impl !RefUnwindSafe for ConnectionPool
impl Send for ConnectionPool
impl Sync for ConnectionPool
impl Unpin for ConnectionPool
impl !UnwindSafe for ConnectionPool
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
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request