pub struct PruningState {
pub markers: BTreeMap<String, PruningPhase>,
}Expand description
State carried alongside a CRDT entry — maps each removed node to its pruning phase. Per, the map’s keys are the addresses that have left the cluster.
Fields§
§markers: BTreeMap<String, PruningPhase>Implementations§
Source§impl PruningState
impl PruningState
pub fn new() -> Self
Sourcepub fn initialize(&mut self, removed_node: String, owner: String)
pub fn initialize(&mut self, removed_node: String, owner: String)
Announce that removed_node is being pruned, with owner
taking over. No-op if a marker for removed_node already
exists in any phase.
Sourcepub fn mark_performed(&mut self, removed_node: &str, obsolete_at: u64) -> bool
pub fn mark_performed(&mut self, removed_node: &str, obsolete_at: u64) -> bool
Mark that pruning of removed_node has been observed
everywhere; the marker can be aged out at obsolete_at.
Returns true if the phase advanced from Initialized →
Performed.
Sourcepub fn is_pruned(&self, removed_node: &str) -> bool
pub fn is_pruned(&self, removed_node: &str) -> bool
True if removed_node is currently being pruned.
Sourcepub fn owner(&self, removed_node: &str) -> Option<&str>
pub fn owner(&self, removed_node: &str) -> Option<&str>
Return the owner that has taken over removed_node, if any.
Trait Implementations§
Source§impl Clone for PruningState
impl Clone for PruningState
Source§fn clone(&self) -> PruningState
fn clone(&self) -> PruningState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PruningState
impl Debug for PruningState
Source§impl Default for PruningState
impl Default for PruningState
Source§fn default() -> PruningState
fn default() -> PruningState
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PruningState
impl<'de> Deserialize<'de> for PruningState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for PruningState
impl PartialEq for PruningState
Source§impl Serialize for PruningState
impl Serialize for PruningState
impl Eq for PruningState
impl StructuralPartialEq for PruningState
Auto Trait Implementations§
impl Freeze for PruningState
impl RefUnwindSafe for PruningState
impl Send for PruningState
impl Sync for PruningState
impl Unpin for PruningState
impl UnsafeUnpin for PruningState
impl UnwindSafe for PruningState
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