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; }
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); }); }
public static Props Props(CRDTService <TCrdt, TValue> service) { return(Actor.Props.Create(() => new CRDTManager <TCrdt, TValue>(service)).WithDeploy(Deploy.Local)); }
public static Props Props(CRDTService <TCrdt, TValue> service, string crdtId) { return(Actor.Props.Create(() => new CRDTActor <TCrdt, TValue>(service, crdtId)).WithDeploy(Deploy.Local)); }