MemoryAddrBook class
A memory-based implementation of the AddrBook interface.
- Implemented types
Constructors
- MemoryAddrBook.new({int maxUnconnectedAddrs = 1000000})
- Creates a new memory-based address book implementation.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxSignedPeerRecords ↔ int
-
getter/setter pair
- maxUnconnectedAddrs ↔ int
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addAddr(
PeerId p, MultiAddr addr, Duration ttl) → Future< void> -
AddAddr calls AddAddrs(p,
addr
, ttl)override -
addAddrs(
PeerId p, List< MultiAddr> addrs, Duration ttl) → Future<void> -
AddAddrs gives this AddrBook addresses to use, with a given ttl
(time-to-live), after which the address is no longer valid.
If the manager has a longer TTL, the operation is a no-op for that address
override
-
addrs(
PeerId p) → Future< List< MultiAddr> > -
Addrs returns all known (and valid) addresses for a given peer.
override
-
addrStream(
PeerId id) → Future< Stream< MultiAddr> > -
AddrStream returns a stream that gets all addresses for a given
peer sent on it. If new addresses are added after the call is made
they will be sent along through the stream as well.
override
-
clearAddrs(
PeerId p) → Future< void> -
ClearAddresses removes all previously stored addresses.
override
-
consumePeerRecord(
Envelope recordEnvelope, Duration ttl) → Future< bool> -
ConsumePeerRecord stores a signed peer record and the contained addresses for
ttl duration.
The addresses contained in the signed peer record will expire after ttl. If any
address is already present in the peer store, it'll expire at max of existing ttl and
provided ttl.
The signed peer record itself will be expired when all the addresses associated with the peer,
self-certified or not, are removed from the AddrBook.
override
-
getPeerRecord(
PeerId p) → Future< Envelope?> -
GetPeerRecord returns an Envelope containing a peer record for the
peer, or null if no record exists.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
peersWithAddrs(
) → Future< List< PeerId> > -
PeersWithAddrs returns all the peer IDs stored in the AddrBook.
override
-
setAddr(
PeerId p, MultiAddr addr, Duration ttl) → Future< void> -
SetAddr calls SetAddrs(p,
addr
, ttl)override -
setAddrs(
PeerId p, List< MultiAddr> addrs, Duration ttl) → Future<void> -
SetAddrs sets the ttl on addresses. This clears any TTL there previously.
This is used when we receive the best estimate of the validity of an address.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
updateAddrs(
PeerId p, Duration oldTTL, Duration newTTL) → Future< void> -
UpdateAddrs updates the addresses associated with the given peer that have
the given oldTTL to have the given newTTL.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited