pub struct PeerSelectorSlot {
pub class: &'static str,
}Expand description
Generic PeerSelector slot placeholder. Bind a concrete
PeerSelectorRuntime via Node::with_peer_selector(...).
Exposes Sample, CurrentView
class tags every Output<PeerId> this placeholder yields with
the class of peer it samples from. The compiler’s
infer_peer_classes pass reads that tag to attribute downstream
wire.sends to the right destination class - that’s what makes
gossip’s self-send case partition correctly (1 class → 1
partition with both send and synthesized recv).
Fields§
§class: &'static strClass identifier the compiler stamps onto every produced
Output<PeerId> via peer_class metadata. Defaults to
bb_ir::peer_class::SELF_CLASS for placeholders
constructed via Default - that puts samples on the same
class as the registering Node, the natural gossip case.
Implementations§
Source§impl PeerSelectorSlot
impl PeerSelectorSlot
Sourcepub fn of_class(class: &'static str) -> Self
pub fn of_class(class: &'static str) -> Self
Construct a sampling placeholder bound to the given class. Use
PeerSelectorSlot::of_class("gossip_peer") to tag samples as
“gossip peers” so a downstream wire.send(payload, neighbor)
puts its data output on the same gossip_peer partition.
Sourcepub fn sample(&self, g: &mut Graph, n: i64) -> Output
pub fn sample(&self, g: &mut Graph, n: i64) -> Output
Sample(n) -> peers - Shape 2 (state-dependent sampling).
Sourcepub fn current_view(&self, g: &mut Graph) -> Output
pub fn current_view(&self, g: &mut Graph) -> Output
CurrentView() -> view - Shape 2 (state read).
Trait Implementations§
Source§impl Clone for PeerSelectorSlot
impl Clone for PeerSelectorSlot
Source§fn clone(&self) -> PeerSelectorSlot
fn clone(&self) -> PeerSelectorSlot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more