Skip to main content

Arbiter

Struct Arbiter 

Source
pub struct Arbiter { /* private fields */ }
Expand description

One consumer’s arbitration of one role (§2.5 to §2.11): a pure state machine over events that carry their instants, with no clock and no I/O. It asks reads (Step::reread) and is told what they found (Event::Read); it is told of a move (Event::Moved) and of the round trip after it (Event::Stood). A restart is a new Arbiter.

Implementations§

Source§

impl Arbiter

Source

pub fn new( declared: &Arbitrated, binding: Binding, params: BTreeMap<String, String>, ) -> Self

The arbitration of a role declared declared, bound by binding, its parameter bindings params resolved (a self.system or self.service replaced by the consumer’s own; core R2). It holds nothing until Arbiter::start.

Source

pub fn ask(&self) -> Asked

A presence read is asked now: what it carries back in Event::Read, so it applies to no token heard since (observer §3.6).

Source

pub fn deadline(&self) -> Duration

The deadline it judges by (§2.3).

Source

pub fn binding(&self) -> &Binding

Its binding.

Source

pub fn active(&self) -> Option<&Addr>

The active provider, None in the dead-man (§2.9, §2.11).

Source

pub fn dead_man(&self) -> bool

Whether it holds the dead-man (§2.11).

Source

pub fn due(&self) -> Option<Mono>

The active provider’s due instant: its last arrival plus the deadline, after which it has missed (timing.v1 §2.5). The runtime arms its timer to fire after it, within the detection bound. None in the dead-man, where only an arrival can make a provider eligible (§2.9).

Source

pub fn moving(&self) -> bool

Whether a move is pending (§2.8).

Source

pub fn providers(&self) -> impl Iterator<Item = &Addr>

The providers known, in rank order (§2.4).

Source

pub fn counts(&self, a: &Addr) -> Counts

The counts of a provider’s samples (§2.5).

Source

pub fn discards(&self) -> Discards

The counts of the samples with no provider (§2.5).

Source

pub fn withdrawn(&self, a: &Addr) -> bool

Whether a provider is withdrawn (§2.7).

Source

pub fn identify(&self, key: &str) -> Result<Addr, Outcome>

The provider a sample’s key names, or why it has none (§2.5’s outcomes 1 to 3): never from the payload.

Source

pub fn start(&mut self, at: Mono) -> Step

Starts: the dead-man, cause start (§2.11), every provider’s tracker started (timing.v1 §2.5). Called once.

Source

pub fn observe(&mut self, at: Mono, event: Event<'_>) -> Step

Hands it an event at instant at, never before the last one’s: it decides the time first, then the event, then selects (§2.9).

Trait Implementations§

Source§

impl Clone for Arbiter

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Arbiter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Arbiter

§

impl Freeze for Arbiter
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze, PhantomData<Segment>: Freeze, *const LeafNode<String, String> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(String, String)>>: Freeze, PhantomData<Entry>: Freeze, *const LeafNode<Rank, Provider> is !null: Freeze, PhantomData<Box<(Rank, Provider)>>: Freeze, PhantomData<Kept>: Freeze,

§

impl Move for Arbiter

§

impl RefUnwindSafe for Arbiter

§

impl Send for Arbiter
where RawVecInner: Send, NodeRef<Owned, String, String, LeafOrInternal>: Send, BoxRaw<(String, String)>: Send, NodeRef<Owned, Rank, Provider, LeafOrInternal>: Send, BoxRaw<(Rank, Provider)>: Send, NodeRef<Owned, InstanceId, SetValZST, LeafOrInternal>: Send, BoxRaw<(InstanceId, SetValZST)>: Send,

§

impl Sync for Arbiter
where RawVecInner: Sync, NodeRef<Owned, String, String, LeafOrInternal>: Sync, BoxRaw<(String, String)>: Sync, NodeRef<Owned, Rank, Provider, LeafOrInternal>: Sync, BoxRaw<(Rank, Provider)>: Sync, NodeRef<Owned, InstanceId, SetValZST, LeafOrInternal>: Sync, BoxRaw<(InstanceId, SetValZST)>: Sync,

§

impl Unpin for Arbiter
where *const u8 is !null: Unpin, *const LeafNode<String, String> is !null: Unpin, Box<(String, String)>: Unpin, *const LeafNode<Rank, Provider> is !null: Unpin, Box<(Rank, Provider)>: Unpin, *const LeafNode<InstanceId, SetValZST> is !null: Unpin, Box<(InstanceId, SetValZST)>: Unpin,

§

impl UnsafeUnpin for Arbiter

§

impl UnwindSafe for Arbiter
where RawVecInner: UnwindSafe, BTreeMap<String, String>: UnwindSafe, BTreeMap<Rank, Provider>: UnwindSafe, BTreeMap<InstanceId, SetValZST>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsNode<T> for T

Source§

fn as_node(&self) -> &T

Source§

impl<T> AsNodeMut<T> for T

Source§

fn as_node_mut(&mut self) -> &mut T

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.