コード例 #1
0
ファイル: ActorContext.cs プロジェクト: dhalsim/language-ext
        public static Unit RemoveWatcher(ProcessId watcher, ProcessId watching)
        {
            Process.logInfo(watcher + " stopped watching " + watching);

            lock (sync)
            {
                watchers = watchers.AddOrUpdate(watching,
                                                Some: set => set.Remove(watcher),
                                                None: () => Set.empty <ProcessId>()
                                                );

                if (watchers[watching].IsEmpty)
                {
                    watchers = watchers.Remove(watching);
                }

                watchings = watchings.AddOrUpdate(watcher,
                                                  Some: set => set.Remove(watching),
                                                  None: () => Set.empty <ProcessId>()
                                                  );

                if (watchings[watcher].IsEmpty)
                {
                    watchers = watchers.Remove(watcher);
                }
            }
            return(unit);
        }
コード例 #2
0
ファイル: Actor.cs プロジェクト: pahomovda/language-ext
 /// <summary>
 /// Disowns a child process
 /// </summary>
 public Unit UnlinkChild(ProcessId pid)
 {
     lock (sync)
     {
         children = children.Remove(pid.GetName().Value);
     }
     return(unit);
 }
コード例 #3
0
ファイル: ActorContext.cs プロジェクト: dhalsim/language-ext
 public static Unit RemoveDispatcher(ProcessName name)
 {
     lock (sync)
     {
         dispatchers = dispatchers.Remove(name);
     }
     return(unit);
 }
コード例 #4
0
ファイル: ActorContext.cs プロジェクト: dhalsim/language-ext
 static void RemoveLocalRegisteredById(ProcessId pid)
 {
     lock (regsync)
     {
         var names = registeredProcessIds.Find(pid).IfNone(Set.empty <ProcessName>());
         names.Iter(name =>
                    registeredProcessNames = registeredProcessNames.SetItem(name, registeredProcessNames[name].Remove(pid))
                    );
         registeredProcessIds = registeredProcessIds.Remove(pid);
     }
 }
コード例 #5
0
ファイル: ActorContext.cs プロジェクト: dhalsim/language-ext
        static void RemoveLocalRegisteredByName(ProcessName name)
        {
            lock (regsync)
            {
                var pids = registeredProcessNames.Find(name).IfNone(Set.empty <ProcessId>());

                pids.Iter(pid =>
                          registeredProcessIds = registeredProcessIds.SetItem(pid, registeredProcessIds[pid].Remove(name))
                          );
                registeredProcessNames = registeredProcessNames.Remove(name);
            }
        }
コード例 #6
0
ファイル: ActorContext.cs プロジェクト: dhalsim/language-ext
        static Unit RemoteDispatchTerminate(ProcessId terminating)
        {
            watchings.Find(terminating).IfSome(ws =>
            {
                var term = new TerminatedMessage(terminating);
                ws.Iter(w =>
                {
                    try
                    {
                        TellUserControl(w, term);
                    }
                    catch (Exception e)
                    {
                        Process.logErr(e);
                    }
                });
            });
            watchings.Remove(terminating);
            watchers = watchers.Remove(terminating);

            return(unit);
        }
コード例 #7
0
        public void UnsubscribeChannel(string channelName)
        {
            channelName += Config.CatalogueName;

            Retry(() => redis.GetSubscriber().Unsubscribe(channelName));
            lock (subscriptions)
            {
                if (subscriptions.ContainsKey(channelName))
                {
                    subscriptions[channelName].OnCompleted();
                    subscriptions = subscriptions.Remove(channelName);
                }
            }
        }
コード例 #8
0
        public static Map <A, Map <B, C> > Remove <A, B, C>(this Map <A, Map <B, C> > self, A outerKey, B innerKey)
        {
            var b = self.Find(outerKey);

            if (b.IsSome)
            {
                var bv = b.Value.Remove(innerKey);
                if (bv.Count() == 0)
                {
                    return(self.Remove(outerKey));
                }
                else
                {
                    return(self.SetItem(outerKey, bv));
                }
            }
            else
            {
                return(self);
            }
        }
コード例 #9
0
        public static Map <A, Map <B, Map <C, D> > > Remove <A, B, C, D>(this Map <A, Map <B, Map <C, D> > > self, A aKey, B bKey, C cKey)
        {
            var b = self.Find(aKey);

            if (b.IsSome)
            {
                var c = b.Value.Find(bKey);
                if (c.IsSome)
                {
                    var cv = c.Value.Remove(cKey);
                    if (cv.Count() == 0)
                    {
                        var bv = b.Value.Remove(bKey);
                        if (b.Value.Count() == 0)
                        {
                            return(self.Remove(aKey));
                        }
                        else
                        {
                            return(self.SetItem(aKey, bv));
                        }
                    }
                    else
                    {
                        return(self.SetItem(aKey, b.Value.SetItem(bKey, cv)));
                    }
                }
                else
                {
                    return(self);
                }
            }
            else
            {
                return(self);
            }
        }
コード例 #10
0
 /// <summary>
 /// Attempts to set a meta-data item.  If it is already set, nothing
 /// happens.
 ///
 /// This is for extending the default strategies behaviours and
 /// allows for state to survive in-between Process errors
 /// </summary>
 public StrategyState RemoveMetaData <T>(string key) =>
 With(Metadata: Metadata.Remove(key));
コード例 #11
0
 public State RemoveMember(ProcessName nodeName) =>
 new State(Members.Remove(nodeName), System);
コード例 #12
0
 public State ClearSession(string sid) =>
 new State(Sessions.Remove(sid), Metadata.Remove(sid));
コード例 #13
0
ファイル: Map.cs プロジェクト: linearregression/language-ext
 /// <summary>
 /// Atomically removes an item from the map
 /// If the key doesn't exists, the request is ignored.
 /// </summary>
 /// <param name="key">Key</param>
 /// <returns>New map with the item removed</returns>
 public static Map <K, V> remove <K, V>(Map <K, V> map, K key) =>
 map.Remove(key);
コード例 #14
0
ファイル: Actor.cs プロジェクト: pahomovda/language-ext
 public Unit RemoveSubscription(ProcessId pid)
 {
     subs.Find(pid.Path).IfSome(x => x.Dispose());
     subs = subs.Remove(pid.Path);
     return(unit);
 }