Exemple #1
0
 private CRDTActor(CRDTService <TCrdt, TValue> service, string crdtId)
 {
     this.crdtId = crdtId;
     ops         = service.Operations;
     crdt        = ops.Default;
     eventLog    = service.EventLog;
     id          = service.ServiceId + "_" + crdtId;
     aggregateId = Uri.EscapeDataString(crdt.GetType().Name) + "_" + crdtId;
 }
Exemple #2
0
        public CRDTManager(CRDTService <TCrdt, TValue> service)
        {
            var crdts = ImmutableDictionary <string, IActorRef> .Empty;

            Receive <ICrdtIdentified>(identified =>
            {
                IActorRef crdtRef;
                if (!crdts.TryGetValue(identified.CrdtId, out crdtRef))
                {
                    crdtRef = Context.ActorOf(CRDTActor <TCrdt, TValue> .Props(service, identified.CrdtId));
                    crdts   = crdts.SetItem(identified.CrdtId, crdtRef);
                }

                crdtRef.Forward(identified);
            });
        }
Exemple #3
0
 public static Props Props(CRDTService <TCrdt, TValue> service)
 {
     return(Actor.Props.Create(() => new CRDTManager <TCrdt, TValue>(service)).WithDeploy(Deploy.Local));
 }
Exemple #4
0
 public static Props Props(CRDTService <TCrdt, TValue> service, string crdtId)
 {
     return(Actor.Props.Create(() => new CRDTActor <TCrdt, TValue>(service, crdtId)).WithDeploy(Deploy.Local));
 }