public static Replica Empty(ReplicaId replicaId) => new Replica( replicaId, opsCounter: bigint.Zero, document: Node.EmptyMap, variables: Map <Var, Cursor>(), processedOps: Set <Id>(), generatedOps: Lst <Operation> .Empty, receivedOps: Lst <Operation> .Empty);
private Replica( ReplicaId replicaId, bigint opsCounter, Node document, Map <Var, Cursor> variables, Set <Id> processedOps, Lst <Operation> generatedOps, Lst <Operation> receivedOps) { OpsCounter = opsCounter; Document = document; ReplicaId = replicaId; Variables = variables; ProcessedOps = processedOps; GeneratedOps = generatedOps; ReceivedOps = receivedOps; }
private Replica Copy( ReplicaId replicaId = null, bigint?opsCounter = null, Node document = null, Map <Var, Cursor>?variables = null, Set <Id>?processedOps = null, Lst <Operation>?generatedOps = null, Lst <Operation>?receivedOps = null) { return(new Replica( replicaId ?? ReplicaId, opsCounter ?? OpsCounter, document ?? Document, variables ?? Variables, processedOps ?? ProcessedOps, generatedOps ?? GeneratedOps, receivedOps ?? ReceivedOps)); }
public void Integration_test() { var p0 = Replica.Empty(ReplicaId.New("p")).ApplyCmd(new Doc().DownField("key").Assign("A")); var q0 = Merge(Replica.Empty(ReplicaId.New("q")), p0); // Assert that p0 and q0 are converged Converged(p0, q0); var p1 = p0.ApplyCmd(new Doc().DownField("key").Assign("B")); var q1 = q0.ApplyCmd(new Doc().DownField("key").Assign("C")); // Assert that p1 and q1 are diverged Diverged(p1, q1); var p2 = Merge(p1, q1); var q2 = Merge(q1, p1); // Assert that p2 and q2 are converged again. Converged(p2, q2); }
public Id(bigint opsCounter, ReplicaId replicaId) { _opsCounter = opsCounter; _replicaId = replicaId; }