pub struct FactsExchange { /* private fields */ }Expand description
Node-local facts distribution.
Implementations§
Source§impl FactsExchange
impl FactsExchange
Sourcepub fn new(
key: SigningKey,
membership: Arc<ClusterMembership>,
runtime: Arc<MeshRuntime>,
policy: FactsTrustPolicy,
) -> Arc<Self> ⓘ
pub fn new( key: SigningKey, membership: Arc<ClusterMembership>, runtime: Arc<MeshRuntime>, policy: FactsTrustPolicy, ) -> Arc<Self> ⓘ
Exchange for the node owning key, sending over runtime and
caching in membership.
Sourcepub fn start(self: &Arc<Self>)
pub fn start(self: &Arc<Self>)
Install as the runtime’s facts sink and announce the current facts to every peer that joins or recovers. Call once.
Sourcepub fn on_peer_gone(&self, node_id: &str) -> bool
pub fn on_peer_gone(&self, node_id: &str) -> bool
A peer’s connection ended or its admission was revoked: lower its
mesh-derived tier to Discovered. An operator-set tier stays.
Sourcepub fn membership(&self) -> &Arc<ClusterMembership> ⓘ
pub fn membership(&self) -> &Arc<ClusterMembership> ⓘ
The membership whose cache this exchange fills.
Sourcepub async fn publish(
&self,
facts: NodeFacts,
now: u64,
) -> Result<u64, NodeFactsAdvertError>
pub async fn publish( &self, facts: NodeFacts, now: u64, ) -> Result<u64, NodeFactsAdvertError>
Sign facts as the new base (its seq is replaced by the next one),
cache them as the local node (pinned) and send them to every peer.
Sourcepub async fn update_live(
&self,
probed: NodeFacts,
now: u64,
) -> Result<Published, NodeFactsAdvertError>
pub async fn update_live( &self, probed: NodeFacts, now: u64, ) -> Result<Published, NodeFactsAdvertError>
Publish a fresh probe of the local node: a delta when only live state (capability states, free memory) changed since the last base, a new base when the capability set changed or the base is nearing its TTL, nothing when nothing changed.
Sourcepub fn ingest(
&self,
ctx: &PeerCtx,
wire: FactsWire,
now: u64,
replies: &mut Vec<FactsWire>,
) -> Result<IngestOutcome, IngestError>
pub fn ingest( &self, ctx: &PeerCtx, wire: FactsWire, now: u64, replies: &mut Vec<FactsWire>, ) -> Result<IngestOutcome, IngestError>
Self::ingest_from with no connection id (no per-connection quota).
Sourcepub fn ingest_from(
&self,
ctx: &PeerCtx,
conn: u64,
wire: FactsWire,
now: u64,
replies: &mut Vec<FactsWire>,
) -> Result<IngestOutcome, IngestError>
pub fn ingest_from( &self, ctx: &PeerCtx, conn: u64, wire: FactsWire, now: u64, replies: &mut Vec<FactsWire>, ) -> Result<IngestOutcome, IngestError>
Receive one facts message from connection conn (identity ctx), at
now. Replies to send back to the peer are appended to replies.
The tier is derived from ctx on every frame: a node that is no
longer admitted drops back to Discovered with its next frame (or
when its connection goes, see Self::start); only a tier an
operator set is kept.
Trait Implementations§
Source§impl PeerControlSink for FactsExchange
impl PeerControlSink for FactsExchange
Auto Trait Implementations§
impl !Freeze for FactsExchange
impl !RefUnwindSafe for FactsExchange
impl !UnwindSafe for FactsExchange
impl Send for FactsExchange
impl Sync for FactsExchange
impl Unpin for FactsExchange
impl UnsafeUnpin for FactsExchange
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more