예제 #1
0
        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]);
        }
예제 #2
0
 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)
                                                                 );
     }
 }
예제 #3
0
 public TerminatedMessage SetSystem(SystemName sys) =>
 new TerminatedMessage(Id.SetSystem(sys));
예제 #4
0
 public ActorResponse SetSystem(SystemName sys) =>
 new ActorResponse(Message, ResponseMessageType, ReplyTo.SetSystem(sys), ReplyFrom.SetSystem(sys), RequestId, IsFaulted);
예제 #5
0
 public ActorRequest SetSystem(SystemName sys) =>
 new ActorRequest(Message, To.SetSystem(sys), ReplyTo.SetSystem(sys), RequestId);