Пример #1
0
        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);
        }
Пример #2
0
        private static ProcessId FixRootName(string pid)
        {
            ProcessId cpid = pid;

            return(cpid.Take(1).GetName().Value == "root"
                ? Root.Append(cpid.Skip(1))
                : cpid);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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"]));
            }
        }
Пример #5
0
 public static Map <ProcessName, ClusterNode> Nodes(ProcessId leaf) =>
 ClusterNodes.Filter(node => node.Role == leaf.Take(1).GetName());
Пример #6
0
 internal static IActorDispatch GetLocalDispatcher(ProcessId pid) =>
 pid.Take(2) == Root["js"]
         ? GetJsDispatcher(pid)
         : GetDispatcher(pid.Tail(), rootItem, pid);
Пример #7
0
 public static Map<ProcessName, ClusterNode> Nodes(ProcessId leaf) =>
     ClusterNodes.Filter(node => node.Role == leaf.Take(1).GetName());
Пример #8
0
 internal static bool IsRegistered(ProcessId pid) =>
 pid.Take(2).GetName().Value == ActorConfig.Default.RegisteredProcessName.Value;
Пример #9
0
 public static Map <ProcessName, ClusterNode> Nodes(ProcessId leaf, SystemName system = default(SystemName)) =>
 ClusterNodes(system).Filter(node => node.Role == leaf.Take(1).Name);
Пример #10
0
 public static Map<ProcessName, ClusterNode> Nodes(ProcessId leaf, SystemName system = default(SystemName)) =>
     ClusterNodes(system).Filter(node => node.Role == leaf.Take(1).Name);