pub struct BestEffortBroadcast<P, L = PerfectLink<P>> { /* private fields */ }Expand description
Fan-out to every process over perfect links.
L is the link beneath, and it is a parameter rather than a fixed type. What this layer needs
of it is stated in one bound and nowhere else: Link, the port. Anything satisfying it — a
session link, a logged link, or an application’s own driver — can carry this broadcast without
either side being edited. That is the seam docs/conditional-guarantees.md describes, made
checkable.
Fan-out needs nothing of a scope boundary, so the bound is the port and nothing more. This layer composes over every link there is, and passes a boundary upward untouched because it has no redundancy with which to repair one.
It defaults to PerfectLink, so the ordinary stack is still written BestEffortBroadcast<P>.
Implementations§
Source§impl<P, L> BestEffortBroadcast<P, L>
impl<P, L> BestEffortBroadcast<P, L>
Source§impl<P> BestEffortBroadcast<P, PerfectLink<P>>
impl<P> BestEffortBroadcast<P, PerfectLink<P>>
Sourcepub fn new(
me: NodeId,
peers: impl IntoIterator<Item = NodeId>,
interval: Duration,
) -> Self
pub fn new( me: NodeId, peers: impl IntoIterator<Item = NodeId>, interval: Duration, ) -> Self
Broadcast among peers, which must include me, over the book’s perfect link.
Sourcepub fn delivered_count(&self) -> usize
pub fn delivered_count(&self) -> usize
How many distinct messages the link below has delivered upward.
Specific to the perfect link, so it lives here rather than on every link.
Trait Implementations§
Source§impl<P: Clone, L> Protocol for BestEffortBroadcast<P, L>where
L: VolatileLink<P>,
impl<P: Clone, L> Protocol for BestEffortBroadcast<P, L>where
L: VolatileLink<P>,
Source§type Scope = <L as Protocol>::Scope
type Scope = <L as Protocol>::Scope
Whatever the link’s guarantees are conditional on, since this layer adds no condition of its own and cannot bridge the link’s.
Source§type Meta = Infallible
type Meta = Infallible
Keeps nothing durably: a crash loses everything this protocol knows.
Source§fn on_scope_event(&mut self, scope: L::Scope, cx: &mut ProtoCx<'_, Self>)
fn on_scope_event(&mut self, scope: L::Scope, cx: &mut ProtoCx<'_, Self>)
Hand the scope ending down to the link, which is the layer that knows what it means.
Scope is the link’s, so leaving this to the trait’s default would take a scope event the
driver raised and drop it — the layer above would never learn its guarantees had lapsed,
and neither would the link. That is the failure docs/conditional-guarantees.md calls
cardinal, and the default is silent about committing it, which is why this handler exists
even though its body only forwards.
Source§type Entry = Infallible
type Entry = Infallible
Source§fn on_cmd(&mut self, cmd: Cmd<P>, cx: &mut ProtoCx<'_, Self>)
fn on_cmd(&mut self, cmd: Cmd<P>, cx: &mut ProtoCx<'_, Self>)
Source§fn on_msg(&mut self, from: NodeId, msg: L::Msg, cx: &mut ProtoCx<'_, Self>)
fn on_msg(&mut self, from: NodeId, msg: L::Msg, cx: &mut ProtoCx<'_, Self>)
from.