Skip to main content

Module ConnectionPool

Module ConnectionPool 

Source
Expand description

§Connection pool

Bounded IPC connection pool with health monitoring, lifetime / idle cleanup, and statistics. The Pool::Struct aggregator + giant impl lives in Pool.rs (tightly-coupled cluster); the per-connection state, the health-status enum, the config, the stats DTO, and the background health checker each live in their own sibling.

Modules§

ConnectionHandle
Per-connection state - id, lifecycle timestamps, rolling health score, error / success counters, and a ConnectionHealth::Enum summary. update_health adjusts the score on each operation; is_healthy decides whether the pool can hand the connection out.
ConnectionHealth
Health classification for ConnectionHandle::Struct - Healthy (default), Unhealthy (failed health check), Degraded (degraded but still usable).
HealthChecker
Per-connection health-probe helper used by Pool::Struct::start_health_monitoring. Currently runs a simulated 10ms ping; real implementations would send a protocol-level keepalive.
Pool
Pool::Struct - bounded connection pool with health monitoring, idle/lifetime cleanup, wait-queue timeouts, and statistics. Acquire via get_connection (drops a permit on the inner Semaphore); return via release_connection. The struct + 18-method impl + Clone + tests stay in one file - tightly coupled cluster.
PoolConfig
Connection-pool tunables: max / min connection counts plus the four millisecond budgets (acquire timeout, max lifetime, idle timeout, health-check interval).
PoolStats
Aggregated pool counters surfaced to the dashboard - total / active / idle / healthy connection counts, queue size, average wait time, total / successful operation tallies, and the rolled-up error rate.