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 TerminatedMessage SetSystem(SystemName sys) => new TerminatedMessage(Id.SetSystem(sys));
public ActorResponse SetSystem(SystemName sys) => new ActorResponse(Message, ResponseMessageType, ReplyTo.SetSystem(sys), ReplyFrom.SetSystem(sys), RequestId, IsFaulted);
public ActorRequest SetSystem(SystemName sys) => new ActorRequest(Message, To.SetSystem(sys), ReplyTo.SetSystem(sys), RequestId);