pub struct LwwElementSet { /* private fields */ }Expand description
LWW-Element-Set for synchronizing workflow YAML across peers.
Each workflow ID maps to an LwwEntry. When merging, the entry
with the higher timestamp wins; ties are broken by peer ID ordering.
Implementations§
Source§impl LwwElementSet
impl LwwElementSet
Sourcepub fn new(local_peer: Uuid, resolution: ConflictResolution) -> Self
pub fn new(local_peer: Uuid, resolution: ConflictResolution) -> Self
Create a new empty LWW-Element-Set for the given peer.
Sourcepub fn set(&mut self, workflow_id: &str, yaml: &str) -> LwwEntry
pub fn set(&mut self, workflow_id: &str, yaml: &str) -> LwwEntry
Insert or update a workflow YAML value.
Sourcepub fn remove(&mut self, workflow_id: &str) -> Option<LwwEntry>
pub fn remove(&mut self, workflow_id: &str) -> Option<LwwEntry>
Remove a workflow (add to tombstone set).
Sourcepub fn get(&self, workflow_id: &str) -> Option<&LwwEntry>
pub fn get(&self, workflow_id: &str) -> Option<&LwwEntry>
Get the current value for a workflow.
Sourcepub fn merge(
&mut self,
workflow_id: &str,
remote: &LwwEntry,
) -> (LwwEntry, Option<SyncConflict>)
pub fn merge( &mut self, workflow_id: &str, remote: &LwwEntry, ) -> (LwwEntry, Option<SyncConflict>)
Merge a remote entry for a given workflow ID. Returns the winning entry and any conflict detected.
Sourcepub fn merge_set(&mut self, remote_set: &LwwElementSet) -> Vec<SyncConflict>
pub fn merge_set(&mut self, remote_set: &LwwElementSet) -> Vec<SyncConflict>
Merge an entire remote element set into the local one.
Trait Implementations§
Source§impl Clone for LwwElementSet
impl Clone for LwwElementSet
Source§fn clone(&self) -> LwwElementSet
fn clone(&self) -> LwwElementSet
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 LwwElementSet
impl Debug for LwwElementSet
Source§impl<'de> Deserialize<'de> for LwwElementSet
impl<'de> Deserialize<'de> for LwwElementSet
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 Serialize for LwwElementSet
impl Serialize for LwwElementSet
Source§impl TeamSync for LwwElementSet
impl TeamSync for LwwElementSet
Source§fn push(&self, workflow_id: &str, _yaml: &str) -> Result<SyncState>
fn push(&self, workflow_id: &str, _yaml: &str) -> Result<SyncState>
Push local changes to peers.
Source§fn pull(&self, workflow_id: &str) -> Result<(String, SyncState)>
fn pull(&self, workflow_id: &str) -> Result<(String, SyncState)>
Pull and merge remote changes.
Source§fn state(&self, workflow_id: &str) -> Result<SyncState>
fn state(&self, workflow_id: &str) -> Result<SyncState>
Get the current sync state for a workflow.
Source§fn resolve_conflict(
&self,
workflow_id: &str,
_resolution: &ConflictResolution,
) -> Result<String>
fn resolve_conflict( &self, workflow_id: &str, _resolution: &ConflictResolution, ) -> Result<String>
Resolve a conflict using the configured strategy.
Source§fn local_peer_id(&self) -> Uuid
fn local_peer_id(&self) -> Uuid
Get this node’s unique peer identifier.
Auto Trait Implementations§
impl Freeze for LwwElementSet
impl RefUnwindSafe for LwwElementSet
impl Send for LwwElementSet
impl Sync for LwwElementSet
impl Unpin for LwwElementSet
impl UnsafeUnpin for LwwElementSet
impl UnwindSafe for LwwElementSet
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