Ejemplo n.º 1
0
        private void ConvergentAdd(CRDT.Application.Convergent.Set.OR_SetService <TestType> sourceReplica, TestType value, List <CRDT.Application.Convergent.Set.OR_SetService <TestType> > downstreamReplicas)
        {
            sourceReplica.LocalAdd(value, Guid.NewGuid());

            var(adds, removes) = sourceReplica.State;

            foreach (var downstreamReplica in downstreamReplicas)
            {
                downstreamReplica.Merge(adds, removes);
            }
        }
Ejemplo n.º 2
0
        private void ConvergentRemove(CRDT.Application.Convergent.Set.OR_SetService <TestType> sourceReplica, TestType value, List <CRDT.Application.Convergent.Set.OR_SetService <TestType> > downstreamReplicas)
        {
            var observedTags = sourceReplica.GetTags(value.Id);

            sourceReplica.LocalRemove(value, observedTags);

            var(adds, removes) = sourceReplica.State;

            foreach (var downstreamReplica in downstreamReplicas)
            {
                downstreamReplica.Merge(adds, removes);
            }
        }
Ejemplo n.º 3
0
        private Dictionary <Node, CRDT.Application.Convergent.Set.OR_SetService <TestType> > CreateConvergentReplicas(List <Node> nodes)
        {
            var dictionary = new Dictionary <Node, CRDT.Application.Convergent.Set.OR_SetService <TestType> >();

            foreach (var node in nodes)
            {
                var repository = new OR_SetRepository();
                var service    = new CRDT.Application.Convergent.Set.OR_SetService <TestType>(repository);

                dictionary.Add(node, service);
            }

            return(dictionary);
        }