private void CommutativeAdd(CRDT.Application.Commutative.Set.OR_OptimizedSetService <TestType> sourceReplica, TestType value, List <CRDT.Application.Commutative.Set.OR_OptimizedSetService <TestType> > downstreamReplicas) { var tag = Guid.NewGuid(); sourceReplica.LocalAdd(value, tag); foreach (var downstreamReplica in downstreamReplicas) { downstreamReplica.DownstreamAdd(value, tag); } }
private void CommutativeRemove(CRDT.Application.Commutative.Set.OR_OptimizedSetService <TestType> sourceReplica, TestType value, List <CRDT.Application.Commutative.Set.OR_OptimizedSetService <TestType> > downstreamReplicas) { var observedTags = sourceReplica.GetTags(value.Id); sourceReplica.LocalRemove(value, observedTags); foreach (var downstreamReplica in downstreamReplicas) { downstreamReplica.DownstreamRemove(value, observedTags); } }
private Dictionary <Node, CRDT.Application.Commutative.Set.OR_OptimizedSetService <TestType> > CreateCommutativeReplicas(List <Node> nodes) { var dictionary = new Dictionary <Node, CRDT.Application.Commutative.Set.OR_OptimizedSetService <TestType> >(); foreach (var node in nodes) { var repository = new OR_OptimizedSetRepository(); var service = new CRDT.Application.Commutative.Set.OR_OptimizedSetService <TestType>(repository); dictionary.Add(node, service); } return(dictionary); }