ConnManager class abstract

ConnManager tracks connections to peers, and allows consumers to associate metadata with each peer.

It enables connections to be trimmed based on implementation-defined heuristics. The ConnManager allows libp2p to enforce an upper bound on the total number of open connections.

Implementers

Constructors

ConnManager()

Properties

hashCode → int
The hash code for this object.
no setterinherited
notifiee → Notifiee
Returns an implementation that can be called back to inform of opened and closed connections.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

checkLimit(GetConnLimiter limiter) → String?
Will return an error if the connection manager's internal connection limit exceeds the provided system limit.
close() → Future<void>
Closes the connection manager and stops background processes.
closeConnection(TransportConn conn) → Future<void>
Initiates a graceful shutdown of a connection.
dispose() → Future<void>
Disposes of the connection manager and releases all resources.
getState(TransportConn conn) → ConnectionState?
Returns the current state of a connection.
getStateStream(TransportConn conn) → Stream<ConnectionStateChange>?
Returns a stream of state changes for a specific connection.
getTagInfo(PeerId peerId) → TagInfo?
Returns the metadata associated with the peer, or null if no metadata has been recorded for the peer.
isProtected(PeerId peerId, String tag) → bool
Returns true if the peer is protected for some tag; if the tag is the empty string then it will return true if the peer is protected for any tag
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
protect(PeerId peerId, String tag) → void
Protects a peer from having its connection(s) pruned.
recordActivity(TransportConn tcpConnection) → void
Records activity on a connection and updates its timestamp.
registerConnection(TransportConn conn) → void
Registers a new connection with the connection manager.
tagPeer(PeerId peerId, String tag, int value) → void
Tags a peer with a string, associating a weight with the tag.
toString() → String
A string representation of this object.
inherited
trimOpenConns() → Future<void>
Terminates open connections based on an implementation-defined heuristic.
unprotect(PeerId peerId, String tag) → bool
Removes a protection that may have been placed on a peer, under the specified tag.
untagPeer(PeerId peerId, String tag) → void
Removes the tagged value from the peer.
updateState(TransportConn conn, ConnectionState state, {required Object? error}) → void
Updates the state of a connection and notifies listeners of the state change.
upsertTag(PeerId peerId, String tag, int upsert(int)) → void
Updates an existing tag or inserts a new one.

Operators

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