pub struct LWWField {
pub value: Value,
pub timestamp: Timestamp,
}Expand description
A field value with LWW metadata
Fields§
§value: ValueThe actual field value (JSON-like)
timestamp: TimestampTimestamp for conflict resolution
Implementations§
Source§impl LWWField
impl LWWField
Sourcepub fn new(value: JsonValue, timestamp: Timestamp) -> Self
pub fn new(value: JsonValue, timestamp: Timestamp) -> Self
Create a new LWW field with a value and timestamp
Sourcepub fn merge(&self, other: &LWWField) -> LWWField
pub fn merge(&self, other: &LWWField) -> LWWField
Merge two LWW fields using Last-Write-Wins semantics
This follows the TLA+ verified algorithm:
- If remote is newer (higher timestamp), use remote
- If local is newer, keep local
- If equal timestamps, use deterministic tie-breaking via client_id
Sourcepub fn is_newer_than(&self, other: &LWWField) -> bool
pub fn is_newer_than(&self, other: &LWWField) -> bool
Check if this field is newer than another
Trait Implementations§
Source§impl<'de> Deserialize<'de> for LWWField
impl<'de> Deserialize<'de> for LWWField
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
impl StructuralPartialEq for LWWField
Auto Trait Implementations§
impl Freeze for LWWField
impl RefUnwindSafe for LWWField
impl Send for LWWField
impl Sync for LWWField
impl Unpin for LWWField
impl UnwindSafe for LWWField
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