private Option <ActorItem> GetItem(ProcessId pid, ActorItem current) { if (pid == ProcessId.Top) { return(current); } else { var child = pid.Head().Name.Value; if (current.Actor.Children.ContainsKey(child)) { var process = current.Actor.Children[child]; return(GetItem(pid.Tail(), process)); } else { return(None); } } }
IActorDispatch GetDispatcher(ProcessId pid, ActorItem current, ProcessId orig) { if (pid == ProcessId.Top) { if (current.Inbox is ILocalActorInbox) { return(new ActorDispatchLocal(current, Settings.TransactionalIO)); } else { return(cluster.Match( Some: c => new ActorDispatchRemote(Ping, orig, c, ActorContext.SessionId, Settings.TransactionalIO) as IActorDispatch, None: () => new ActorDispatchNotExist(orig))); } } else { var child = pid.HeadName().Value; return(current.Actor.Children.Find(child, Some: process => GetDispatcher(pid.Tail(), process, orig), None: () => new ActorDispatchNotExist(orig))); } }
private Option <ActorItem> GetItem(ProcessId pid) => pid.IsValid ? pid.Head() == RootProcess.Id ? GetItem(pid.Tail(), root) : failwith <Option <ActorItem> >("Can't get non-local items from within ActorSystemState") : None;
internal IActorDispatch GetLocalDispatcher(ProcessId pid) => pid.Take(2) == RootJS ? GetJsDispatcher(pid) : GetDispatcher(pid.Tail(), rootItem, pid);