Skip to main content

AddressableManager

Trait AddressableManager 

Source
pub trait AddressableManager: Provider {
    // Required methods
    fn track(
        &mut self,
        id: u64,
        peers: Map<Self::PublicKey, Address>,
    ) -> impl Future<Output = ()> + Send;
    fn overwrite(
        &mut self,
        peers: Map<Self::PublicKey, Address>,
    ) -> impl Future<Output = ()> + Send;
}
Expand description

Interface for managing peer set membership (where peer addresses are known).

Required Methods§

Source

fn track( &mut self, id: u64, peers: Map<Self::PublicKey, Address>, ) -> impl Future<Output = ()> + Send

Track a peer set with the given ID and peer<PublicKey, Address> pairs.

The peer set ID passed to this function should be strictly managed, ideally matching the epoch of the consensus engine. It must be monotonically increasing as new peer sets are tracked.

For good connectivity, all peers must track the same peer sets at the same ID.

Source

fn overwrite( &mut self, peers: Map<Self::PublicKey, Address>, ) -> impl Future<Output = ()> + Send

Update addresses for multiple peers without creating a new peer set.

For each peer that is tracked and has a changed address:

  • Any existing connection to the peer is severed (it was on the old IP)
  • The listener’s allowed IPs are updated to reflect the new egress IP
  • Future connections will use the new address

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§