pub struct ClusterState { /* private fields */ }Expand description
Decoupled view of cluster topology + liveness.
Carries enough state for the APL walker to compute an annotated preference list without consulting the live pool:
- a sorted-by-token continuum of
(token, peer_id)ring points (one entry per vnode, may have several entries per peer); - the set of peers currently alive according to the failure detector.
The ring is held as-passed; the constructor sorts it by token.
Implementations§
Source§impl ClusterState
impl ClusterState
Sourcepub fn new(ring: Vec<RingPoint>, alive: HashSet<PeerId>) -> Self
pub fn new(ring: Vec<RingPoint>, alive: HashSet<PeerId>) -> Self
Build a ClusterState from a ring and a liveness set.
The ring is sorted by token (ties broken by peer id) so
callers can pass any ordering without thinking about it.
Empty rings are accepted; get_apl_ann will return an
empty vector for them.
§Examples
use dynomite::cluster::apl::{ClusterState, RingPoint};
let cs = ClusterState::new(
vec![RingPoint::new(2, 1), RingPoint::new(1, 0)],
[0u32, 1].into_iter().collect(),
);
assert_eq!(cs.ring()[0].token, 1);Trait Implementations§
Source§impl Clone for ClusterState
impl Clone for ClusterState
Source§fn clone(&self) -> ClusterState
fn clone(&self) -> ClusterState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ClusterState
impl RefUnwindSafe for ClusterState
impl Send for ClusterState
impl Sync for ClusterState
impl Unpin for ClusterState
impl UnsafeUnpin for ClusterState
impl UnwindSafe for ClusterState
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
Mutably borrows from an owned value. Read more