RelayPoolManager class

Manages a pool of relays with load balancing, health checks, and failover strategies.

Constructors

RelayPoolManager({required NostrLogger logger})
Manages a pool of relays with load balancing, health checks, and failover strategies.

Properties

hashCode int
The hash code for this object.
no setterinherited
logger NostrLogger
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addRelay(String relayUrl) → void
Add a relay to the pool.
decrementConnections(String relayUrl) → void
Decrement active connection count for a relay.
getActiveConnections(String relayUrl) int
Get active connection count for a relay.
getAllRelayHealth() Map<String, RelayHealthStatus>
Get all relay health statuses.
getHealthyRelays(List<String> availableRelays) List<String>
Get all healthy relays sorted by load.
getRelayHealth(String relayUrl) RelayHealthStatus?
Get the health status of a specific relay.
getStatistics() RelayPoolStatistics
Get relay statistics.
incrementConnections(String relayUrl) → void
Increment active connection count for a relay.
initialize(List<String> relayUrls) → void
Initialize relay pool with a list of relay URLs.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
recordFailure(String relayUrl) → void
Record a failed connection attempt to a relay.
recordSuccess(String relayUrl) → void
Record a successful connection to a relay.
removeRelay(String relayUrl) → void
Remove a relay from the pool.
resetAllRelayHealth() → void
Reset all relay health statuses.
resetRelayHealth(String relayUrl) → void
Reset health status for a relay (useful for manual recovery).
selectBestRelay(List<String> availableRelays) String?
Get the best relay based on health and load (round-robin with health awareness).
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

maxFailureThreshold → const int
Maximum failures before marking relay as unhealthy.