Added CRDT snapshotting
This commit is contained in:
@@ -20,6 +20,10 @@ use std::{
|
||||
|
||||
/// An RGA-like list CRDT that can store a CRDT-like datatype
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
#[serde(bound(
|
||||
serialize = "T: serde::Serialize",
|
||||
deserialize = "T: serde::de::DeserializeOwned"
|
||||
))]
|
||||
pub struct ListCrdt<T>
|
||||
where
|
||||
T: CrdtNode,
|
||||
@@ -32,6 +36,7 @@ where
|
||||
pub ops: Vec<Op<T>>,
|
||||
/// Queue of messages where K is the ID of the message yet to arrive
|
||||
/// and V is the list of operations depending on it
|
||||
#[serde(skip)]
|
||||
message_q: HashMap<OpId, Vec<Op<T>>>,
|
||||
/// The sequence number of this node
|
||||
our_seq: SequenceNumber,
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
use crate::debug::DebugView;
|
||||
use crate::json_crdt::{CrdtNode, JsonValue, OpState};
|
||||
use crate::op::{join_path, print_path, Op, PathSegment, SequenceNumber};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::cmp::{max, Ordering};
|
||||
use std::fmt::Debug;
|
||||
|
||||
@@ -14,7 +15,11 @@ use crate::keypair::AuthorId;
|
||||
|
||||
/// A simple delete-wins, last-writer-wins (LWW) register CRDT.
|
||||
/// Basically only for adding support for primitives within a more complex CRDT
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
#[serde(bound(
|
||||
serialize = "T: serde::Serialize",
|
||||
deserialize = "T: serde::de::DeserializeOwned"
|
||||
))]
|
||||
pub struct LwwRegisterCrdt<T>
|
||||
where
|
||||
T: CrdtNode,
|
||||
|
||||
Reference in New Issue
Block a user