pub struct ProviderPool { /* private fields */ }Expand description
Round-robin provider pool with per-provider circuit breakers.
Automatically skips unhealthy (circuit-open) providers and falls back to the next available one.
Implementations§
Source§impl ProviderPool
impl ProviderPool
Sourcepub fn new(
transports: Vec<Arc<dyn RpcTransport>>,
config: ProviderPoolConfig,
) -> Self
pub fn new( transports: Vec<Arc<dyn RpcTransport>>, config: ProviderPoolConfig, ) -> Self
Build a pool from a list of transports.
Sourcepub fn new_with_metrics(
transports: Vec<Arc<dyn RpcTransport>>,
config: ProviderPoolConfig,
) -> Self
pub fn new_with_metrics( transports: Vec<Arc<dyn RpcTransport>>, config: ProviderPoolConfig, ) -> Self
Build a pool with per-provider metrics automatically created.
Sourcepub fn health_summary(&self) -> Vec<(String, HealthStatus, String)>
pub fn health_summary(&self) -> Vec<(String, HealthStatus, String)>
Returns summary of each provider’s health.
Sourcepub fn healthy_count(&self) -> usize
pub fn healthy_count(&self) -> usize
Number of providers whose circuit breaker allows requests.
Sourcepub fn metrics(&self) -> Vec<MetricsSnapshot>
pub fn metrics(&self) -> Vec<MetricsSnapshot>
Return metrics snapshots for all providers that have metrics enabled.
Sourcepub fn health_report(&self) -> Vec<Value>
pub fn health_report(&self) -> Vec<Value>
Detailed health report for each provider as JSON-serializable values.
When per-provider metrics are available the report includes
additional fields such as total_requests, success_rate, and
avg_latency_ms.
Trait Implementations§
Source§impl RpcTransport for ProviderPool
impl RpcTransport for ProviderPool
Source§fn send<'life0, 'async_trait>(
&'life0 self,
req: JsonRpcRequest,
) -> Pin<Box<dyn Future<Output = Result<JsonRpcResponse, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 self,
req: JsonRpcRequest,
) -> Pin<Box<dyn Future<Output = Result<JsonRpcResponse, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a single JSON-RPC request and return the response.
Source§fn health(&self) -> HealthStatus
fn health(&self) -> HealthStatus
Return the current health status of this transport.
Source§fn send_batch<'life0, 'async_trait>(
&'life0 self,
reqs: Vec<JsonRpcRequest>,
) -> Pin<Box<dyn Future<Output = Result<Vec<JsonRpcResponse>, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_batch<'life0, 'async_trait>(
&'life0 self,
reqs: Vec<JsonRpcRequest>,
) -> Pin<Box<dyn Future<Output = Result<Vec<JsonRpcResponse>, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a batch of JSON-RPC requests. Read more
Source§fn call<'life0, 'life1, 'async_trait, T>(
&'life0 self,
id: u64,
method: &'life1 str,
params: Vec<Value>,
) -> Pin<Box<dyn Future<Output = Result<T, TransportError>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
T: 'async_trait + DeserializeOwned,
'life0: 'async_trait,
'life1: 'async_trait,
fn call<'life0, 'life1, 'async_trait, T>(
&'life0 self,
id: u64,
method: &'life1 str,
params: Vec<Value>,
) -> Pin<Box<dyn Future<Output = Result<T, TransportError>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
T: 'async_trait + DeserializeOwned,
'life0: 'async_trait,
'life1: 'async_trait,
Convenience: call a method and deserialize the result.
Auto Trait Implementations§
impl !Freeze for ProviderPool
impl !RefUnwindSafe for ProviderPool
impl Send for ProviderPool
impl Sync for ProviderPool
impl Unpin for ProviderPool
impl UnsafeUnpin for ProviderPool
impl !UnwindSafe for ProviderPool
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