pub struct StateDelta {
pub transform: GA3,
pub encoding: DeltaEncoding,
pub from_clock: VectorClock,
pub to_clock: VectorClock,
pub source_node: Uuid,
}Expand description
A state delta representing the transformation between two states.
Deltas can be represented in different forms for efficiency:
Additive: Simple difference (to - from)Multiplicative: Versor/rotor transformationCompressed: Log-space representation for smaller payloads
Fields§
§transform: GA3The delta transformation
encoding: DeltaEncodingType of delta encoding
from_clock: VectorClockSource state clock (for causal ordering)
to_clock: VectorClockTarget state clock
source_node: UuidNode that computed this delta
Implementations§
Source§impl StateDelta
impl StateDelta
Sourcepub fn additive(
transform: GA3,
from_clock: VectorClock,
to_clock: VectorClock,
source_node: Uuid,
) -> Self
pub fn additive( transform: GA3, from_clock: VectorClock, to_clock: VectorClock, source_node: Uuid, ) -> Self
Create a new additive delta.
Sourcepub fn multiplicative(
transform: GA3,
from_clock: VectorClock,
to_clock: VectorClock,
source_node: Uuid,
) -> Self
pub fn multiplicative( transform: GA3, from_clock: VectorClock, to_clock: VectorClock, source_node: Uuid, ) -> Self
Create a new multiplicative (versor) delta.
Sourcepub fn compressed(
transform: GA3,
from_clock: VectorClock,
to_clock: VectorClock,
source_node: Uuid,
) -> Self
pub fn compressed( transform: GA3, from_clock: VectorClock, to_clock: VectorClock, source_node: Uuid, ) -> Self
Create a compressed (log-space) delta.
Sourcepub fn estimated_size(&self) -> usize
pub fn estimated_size(&self) -> usize
Get the approximate size of this delta in bytes (for bandwidth estimation).
Sourcepub fn is_applicable_to(&self, state_clock: &VectorClock) -> bool
pub fn is_applicable_to(&self, state_clock: &VectorClock) -> bool
Check if this delta is causally applicable to a state with the given clock.
Trait Implementations§
Source§impl Clone for StateDelta
impl Clone for StateDelta
Source§fn clone(&self) -> StateDelta
fn clone(&self) -> StateDelta
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 StateDelta
impl Debug for StateDelta
Source§impl<'de> Deserialize<'de> for StateDelta
impl<'de> Deserialize<'de> for StateDelta
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
Auto Trait Implementations§
impl Freeze for StateDelta
impl RefUnwindSafe for StateDelta
impl Send for StateDelta
impl Sync for StateDelta
impl Unpin for StateDelta
impl UnsafeUnpin for StateDelta
impl UnwindSafe for StateDelta
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