Beispiel #1
0
 static IActorDispatch GetDispatcher(ProcessId pid, ActorItem current, ProcessId orig)
 {
     if (pid == ProcessId.Top)
     {
         if (current.Inbox is ILocalActorInbox)
         {
             return(new ActorDispatchLocal(current));
         }
         else
         {
             return(cluster.Match <IActorDispatch>(
                        Some: c => new ActorDispatchRemote(orig, c),
                        None: () => new ActorDispatchNotExist(orig)));
         }
     }
     else
     {
         var child = pid.Head().GetName().Value;
         if (current.Actor.Children.ContainsKey(child))
         {
             var process = current.Actor.Children[child];
             return(GetDispatcher(pid.Tail(), process, orig));
         }
         else
         {
             return(new ActorDispatchNotExist(orig));
         }
     }
 }
Beispiel #2
0
 internal static IActorDispatch GetRegisteredDispatcher(ProcessId pid) =>
 GetRegisteredItem().Match(
     Some: regd =>
     pid.Count() == 2
                 ? new ActorDispatchLocal(regd)
                 : regd.Actor.Children.ContainsKey(pid.Skip(2).GetName().Value)
                         ? GetDispatcher(pid.Tail(), rootItem, pid)
                         : cluster.Match <IActorDispatch>(
         Some: c => new ActorDispatchRemote(pid.Skip(1), c),
         None: () => new ActorDispatchNotExist(pid)),
     None: () => new ActorDispatchNotExist(pid));
 private Option <ActorItem> GetItem(ProcessId pid, ActorItem current)
 {
     if (pid == ProcessId.Top)
     {
         return(current);
     }
     else
     {
         var child = pid.Head().GetName().Value;
         if (current.Actor.Children.ContainsKey(child))
         {
             var process = current.Actor.Children[child];
             return(GetItem(pid.Tail(), process));
         }
         else
         {
             return(None);
         }
     }
 }
 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;
Beispiel #5
0
 internal static IActorDispatch GetLocalDispatcher(ProcessId pid) =>
 pid.Take(2) == Root["js"]
         ? GetJsDispatcher(pid)
         : GetDispatcher(pid.Tail(), rootItem, pid);
Beispiel #6
0
 private Option <ActorItem> GetItem(ProcessId pid) =>
 pid.IsValid
         ? pid.Head() == RootProcess.Id
             ? GetItem(pid.Tail(), root)
             : GetItem(pid.Tail(), root)
         : None;