Option <ActorItem> GetLocalActor(ActorItem current, ProcessId walk, ProcessId pid) { if (current.Actor.Id == pid) { return(current); } var name = walk.Take(1).Name; return(from child in current.Actor.Children.Find(walk.Take(1).Name.Value) from result in GetLocalActor(child, walk.Skip(1), pid) select result); }
private static ProcessId FixRootName(string pid) { ProcessId cpid = pid; return(cpid.Take(1).GetName().Value == "root" ? Root.Append(cpid.Skip(1)) : cpid); }
public static Unit DeregisterById(ProcessId pid) { if (!pid.IsValid) { throw new InvalidProcessIdException(); } if (pid.Take(2) == Disp["reg"]) { throw new InvalidProcessIdException(@" When de-registering a Process, you should use its actual ProcessId, not its registered ProcessId. Multiple Processes can be registered with the same name, and therefore share the same registered ProcessId. The de-register system can only know for sure which Process to de-register if you pass in the actual ProcessId. If you want to deregister all Processes by name then use Process.deregisterByName(name)."); } Cluster.Match( Some: c => { if (IsLocal(pid) && GetDispatcher(pid).IsLocal) { RemoveLocalRegisteredById(pid); } else { var path = pid.Path; var regpath = path + "-registered"; // TODO - Make this transactional // { var names = c.GetSet <string>(regpath); names.Iter(name => { c.SetRemove(ProcessId.Top["__registered"][name].Path, path); }); c.Delete(regpath); // } } }, None: () => { RemoveLocalRegisteredById(pid); } ); return(unit); }
internal static IActorDispatch GetJsDispatcher(ProcessId pid) { switch (pid.Count()) { case 0: case 1: return(new ActorDispatchNotExist(pid)); // /root/js <-- relay case 2: return(GetDispatcher(pid.Skip(1), rootItem, pid)); // /root/js/{connection id} <-- relay case 3: return(GetDispatcher(pid.Skip(1), rootItem, pid)); // /root/js/{connection id}/js-root/.. --> back to JS default: return(new ActorDispatchJS(pid, pid.Take(3), rootItem.Actor.Children["js"])); } }
public static Map <ProcessName, ClusterNode> Nodes(ProcessId leaf) => ClusterNodes.Filter(node => node.Role == leaf.Take(1).GetName());
internal static IActorDispatch GetLocalDispatcher(ProcessId pid) => pid.Take(2) == Root["js"] ? GetJsDispatcher(pid) : GetDispatcher(pid.Tail(), rootItem, pid);
public static Map<ProcessName, ClusterNode> Nodes(ProcessId leaf) => ClusterNodes.Filter(node => node.Role == leaf.Take(1).GetName());
internal static bool IsRegistered(ProcessId pid) => pid.Take(2).GetName().Value == ActorConfig.Default.RegisteredProcessName.Value;
public static Map <ProcessName, ClusterNode> Nodes(ProcessId leaf, SystemName system = default(SystemName)) => ClusterNodes(system).Filter(node => node.Role == leaf.Take(1).Name);
public static Map<ProcessName, ClusterNode> Nodes(ProcessId leaf, SystemName system = default(SystemName)) => ClusterNodes(system).Filter(node => node.Role == leaf.Take(1).Name);