//! Utility functions for exchanging messages with many peers. use crate::{PeerSetUpdate, Provider, TrackedPeers}; use commonware_cryptography::PublicKey; use commonware_utils::{ channel::{ fallible::FallibleExt, mpsc::{self, UnboundedReceiver, UnboundedSender}, }, ordered::Set, }; pub mod codec; pub mod limited; #[cfg(feature = "mocks")] pub mod mocks; pub mod mux; /// Primary and secondary peer memberships at one peer set index. /// /// Import as `PeerSetsAtIndexBase` (or similar) and define a local /// `type PeerSetsAtIndex
= PeerSetsAtIndexBase<...>` with the primary/secondary types you use.
pub(crate) struct PeerSetsAtIndex ,
senders: Vec {
/// Create a new [StaticProvider] with the given ID and peers.
pub const fn new(id: u64, peers: Set ) -> Self {
Self {
id,
peers,
senders: vec![],
}
}
}
impl {
type PublicKey = P;
async fn peer_set(&mut self, id: u64) -> Option