pub struct Members { /* private fields */ }Expand description
The sorted, de-duplicated set of a run’s workers, plus this process’s own index. Sorting makes
the assignment independent of the order workers happened to join in — the invariant owner_of
relies on.
Implementations§
Source§impl Members
impl Members
Sourcepub fn solo() -> Self
pub fn solo() -> Self
A single-worker run — the default when there is no --join. Byte-for-byte the pre-Phase-4
behaviour: one worker owns every task, and the fingerprint clause is empty.
Sourcepub fn new(workers: Vec<String>, my_addr: &str) -> Result<Self, String>
pub fn new(workers: Vec<String>, my_addr: &str) -> Result<Self, String>
From a membership list (in any order) and this process’s own address. The list is sorted and
de-duplicated; me is this address’s index in the sorted set. Errors if my_addr is not in
the set (a worker must be a member of the run it joins).
pub fn is_empty(&self) -> bool
Sourcepub fn is_solo(&self) -> bool
pub fn is_solo(&self) -> bool
A run with exactly one worker: every edge is local and there is nothing to coordinate across processes.
Sourcepub fn addr(&self, w: WorkerId) -> Option<&str>
pub fn addr(&self, w: WorkerId) -> Option<&str>
The address of worker w (for opening exchange links to peers).
Sourcepub fn peers(&self) -> impl Iterator<Item = WorkerId> + '_
pub fn peers(&self) -> impl Iterator<Item = WorkerId> + '_
Every worker’s id except this one — the peers this worker opens links to.
Sourcepub fn fingerprint_clause(&self) -> String
pub fn fingerprint_clause(&self) -> String
The fingerprint clause for this member set. Empty for a solo run, so a single-worker
fingerprint — and every checkpoint written before Phase 4 — is unchanged. For a cluster, the
worker count: placement (owner_of) depends only on the number of workers, so a change to
it changes every task’s owner and must refuse to restore over the old checkpoint (the D8
fence), while a restart of the same-sized cluster — on whatever addresses/ports — restores
cleanly.
Trait Implementations§
impl Eq for Members
impl StructuralPartialEq for Members
Auto Trait Implementations§
impl Freeze for Members
impl RefUnwindSafe for Members
impl Send for Members
impl Sync for Members
impl Unpin for Members
impl UnsafeUnpin for Members
impl UnwindSafe for Members
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.