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); }
/// <summary> /// Disowns a child process /// </summary> public Unit UnlinkChild(ProcessId pid) { lock (sync) { children = children.Remove(pid.GetName().Value); } return(unit); }
public static Unit RemoveDispatcher(ProcessName name) { lock (sync) { dispatchers = dispatchers.Remove(name); } return(unit); }
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); } }
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); } }
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); }
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); } } }
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); } }
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); } }
/// <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));
public State RemoveMember(ProcessName nodeName) => new State(Members.Remove(nodeName), System);
public State ClearSession(string sid) => new State(Sessions.Remove(sid), Metadata.Remove(sid));
/// <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);
public Unit RemoveSubscription(ProcessId pid) { subs.Find(pid.Path).IfSome(x => x.Dispose()); subs = subs.Remove(pid.Path); return(unit); }