public ProcessId Register(ProcessName name, ProcessId pid) { if (!pid.IsValid) { throw new InvalidProcessIdException(); } Cluster.Match( Some: c => { if (IsLocal(pid) && GetDispatcher(pid).IsLocal) { AddLocalRegistered(name, pid.SetSystem(SystemName)); } else { // TODO - Make this transactional // { c.SetAddOrUpdate(ProcessId.Top["__registered"][name].Path, pid.Path); c.SetAddOrUpdate(pid.Path + "-registered", name.Value); // } } }, None: () => AddLocalRegistered(name, pid) ); return(Disp["reg"][name]); }
void AddLocalRegistered(ProcessName name, ProcessId pid) { lock (regsync) { registeredProcessNames = registeredProcessNames.AddOrUpdate(name, Some: set => set.AddOrUpdate(pid.SetSystem(SystemName)), None: () => Set(pid) ); registeredProcessIds = registeredProcessIds.AddOrUpdate(pid.SetSystem(SystemName), Some: set => set.AddOrUpdate(name), None: () => Set(name) ); } }
public ActorResponse SetSystem(SystemName sys) => new ActorResponse(Message, ReplyTo.SetSystem(sys), ReplyFrom.SetSystem(sys), RequestId, ReplyType, IsFaulted);
public TerminatedMessage SetSystem(SystemName sys) => new TerminatedMessage(Id.SetSystem(sys));
public ActorRequest SetSystem(SystemName sys) => new ActorRequest(Message, To.SetSystem(sys), ReplyTo.SetSystem(sys), RequestId);