pub struct SyncPatch {
pub source_node: NodeId,
pub entries: Vec<PatchEntry>,
pub crdt_aware: bool,
}Expand description
A serializable sync patch containing entries to apply to a target database.
Fields§
§source_node: NodeId§entries: Vec<PatchEntry>§crdt_aware: boolImplementations§
Source§impl SyncPatch
impl SyncPatch
Sourcepub fn from_diff(
source_node: NodeId,
diff: &DiffResult,
crdt_aware: bool,
) -> Self
pub fn from_diff( source_node: NodeId, diff: &DiffResult, crdt_aware: bool, ) -> Self
Build a SyncPatch from a DiffResult.
If crdt_aware is true, values are expected to contain CRDT headers
and entries will carry CrdtMeta extracted from the value prefix.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn serialize(&self) -> Vec<u8> ⓘ
pub fn serialize(&self) -> Vec<u8> ⓘ
Serialize to binary wire format.
Format:
[magic: u32 LE][version: u8][flags: u8][source_node: 8B][entry_count: u32 LE]
Per entry:
[key_len: u16 LE][value_len: u32 LE][kind: u8]
[crdt_meta: 20B] (if FLAG_HAS_CRDT)
[key: key_len bytes][value: value_len bytes]Sourcepub fn deserialize(data: &[u8]) -> Result<Self, PatchError>
pub fn deserialize(data: &[u8]) -> Result<Self, PatchError>
Deserialize from binary wire format.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SyncPatch
impl RefUnwindSafe for SyncPatch
impl Send for SyncPatch
impl Sync for SyncPatch
impl Unpin for SyncPatch
impl UnsafeUnpin for SyncPatch
impl UnwindSafe for SyncPatch
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