private void ConvergentAdd(CRDT.Application.Convergent.Set.OR_OptimizedSetService <TestType> sourceReplica, TestType value, List <CRDT.Application.Convergent.Set.OR_OptimizedSetService <TestType> > downstreamReplicas) { sourceReplica.LocalAdd(value, Guid.NewGuid()); foreach (var downstreamReplica in downstreamReplicas) { downstreamReplica.Merge(sourceReplica.State); } }
private void ConvergentRemove(CRDT.Application.Convergent.Set.OR_OptimizedSetService <TestType> sourceReplica, TestType value, List <CRDT.Application.Convergent.Set.OR_OptimizedSetService <TestType> > downstreamReplicas) { var observedTags = sourceReplica.GetTags(value.Id); sourceReplica.LocalRemove(value, observedTags); foreach (var downstreamReplica in downstreamReplicas) { downstreamReplica.Merge(sourceReplica.State); } }
private Dictionary <Node, CRDT.Application.Convergent.Set.OR_OptimizedSetService <TestType> > CreateConvergentReplicas(List <Node> nodes) { var dictionary = new Dictionary <Node, CRDT.Application.Convergent.Set.OR_OptimizedSetService <TestType> >(); foreach (var node in nodes) { var repository = new OR_OptimizedSetRepository(); var service = new CRDT.Application.Convergent.Set.OR_OptimizedSetService <TestType>(repository); dictionary.Add(node, service); } return(dictionary); }