pub struct ProxyPool { /* private fields */ }Expand description
A pool whose clones share clients, counters, cached nodes, and health state.
Implementations§
Source§impl ProxyPool
impl ProxyPool
Sourcepub fn builder() -> PoolBuilder
pub fn builder() -> PoolBuilder
Configure a new shared pool.
Sourcepub fn session(&self, policy: RotationPolicy) -> Result<ProxySession>
pub fn session(&self, policy: RotationPolicy) -> Result<ProxySession>
Create an independently rotating session. New sessions receive initial nodes in round-robin order; no global session map or lifetime limit is needed.
Sourcepub fn last_refresh_report(&self) -> Option<RefreshReport>
pub fn last_refresh_report(&self) -> Option<RefreshReport>
Inspect the most recent startup, manual, or background refresh.
Sourcepub fn stats(&self) -> PoolStats
pub fn stats(&self) -> PoolStats
Inspect node counts without exposing subscription URLs or credentials.
Sourcepub fn nodes(&self) -> Vec<ProxyNode>
pub fn nodes(&self) -> Vec<ProxyNode>
Snapshot configured nodes. Node Debug is redacted; serialization is not.
Sourcepub fn acquire(&self) -> Result<ProxyLease>
pub fn acquire(&self) -> Result<ProxyLease>
Reserve exactly one request attempt. The reservation consumes one quota even if later cancelled; network work does not hold the selection mutex.
Sourcepub async fn execute(&self, request: Request) -> Result<Response>
pub async fn execute(&self, request: Request) -> Result<Response>
Send one request without automatic replay. Reports connection errors, timeouts, transport disconnects, and HTTP 407 as failures. Local request and body-stream errors do not count against the proxy’s health. Other HTTP statuses count as connectivity success. Success is measured when response headers arrive, not when its body is read.
Sourcepub async fn execute_with_failover(
&self,
request: Request,
max_attempts: NonZeroUsize,
) -> Result<Response>
pub async fn execute_with_failover( &self, request: Request, max_attempts: NonZeroUsize, ) -> Result<Response>
Opt-in failover for GET, HEAD, and OPTIONS only. Each attempt uses a distinct eligible node and consumes quota. Only connection/timeouts retry; HTTP responses and uncloneable bodies are never automatically replayed.
Sourcepub async fn refresh(&self) -> Result<RefreshReport>
pub async fn refresh(&self) -> Result<RefreshReport>
Fetch remote sources now regardless of disk TTL. Failed or empty updates retain previous nodes. Unchanged endpoints retain clients and health state.
Sourcepub async fn check_health(&self) -> PoolStats
pub async fn check_health(&self) -> PoolStats
Probe all nodes with bounded concurrency. Probes never consume rotation quota. Open cooldowns are respected; stale probe outcomes cannot overwrite a newer business-request result.
Sourcepub fn spawn_maintenance(&self) -> MaintenanceTask
pub fn spawn_maintenance(&self) -> MaintenanceTask
Start maintenance if needed, sharing tasks with existing handles. The last handle’s drop cancels maintenance. Build never implicitly starts tasks.