/// <summary> /// Clear all settings for the process (or role if outside of the message-loop of a Process) /// </summary> public static Unit clear(SystemName system = default(SystemName)) { if (InMessageLoop) { ActorContext.System(Self) .Settings .ClearSettingsOverride(ActorInboxCommon.ClusterSettingsKey(Self), ActorContext.Request.ProcessFlags); return(unit); } else { return(ActorContext.System(system).Settings.ClearSettingsOverride($"role-{Role.Current.Value}@settings", ProcessFlags.PersistState)); } }
/// <summary> /// Write a setting /// </summary> /// <param name="name">Name of the setting</param> /// <param name="prop">If the setting is a complex value (like a map or record), then /// this selects the property of the setting to access</param> /// <param name="value">Value to set</param> public static Unit write(string name, string prop, object value, SystemName system = default(SystemName)) { if (InMessageLoop) { ActorContext.System(Self) .Settings .WriteSettingOverride(ActorInboxCommon.ClusterSettingsKey(Self), value, name, prop, ActorContext.Request.ProcessFlags); return(unit); } else { return(ActorContext.System(system).Settings.WriteSettingOverride($"role-{Role.Current.Value}@settings", value, name, prop, ProcessFlags.PersistState)); } }
/// <summary> /// Shutdown everything from this node down /// </summary> public Unit Shutdown(bool maintainState) { cancellationTokenSource.Cancel(); // this will signal other operations not to start processing more messages (ProcessMessage) or startup again (Startup), even if they already received something from the queue lock (sync) { if (maintainState == false && Flags != ProcessFlags.Default) { cluster.IfSome(c => { // TODO: Make this transactional // { c.DeleteMany( StateKey, ActorInboxCommon.ClusterUserInboxKey(Id), ActorInboxCommon.ClusterSystemInboxKey(Id), ActorInboxCommon.ClusterMetaDataKey(Id), ActorInboxCommon.ClusterSettingsKey(Id)); sys.DeregisterById(Id); // } sys.Settings.ClearInMemorySettingsOverride(ActorInboxCommon.ClusterSettingsKey(Id)); }); } RemoveAllSubscriptions(); publishSubject.OnCompleted(); stateSubject.OnCompleted(); remoteSubsAcquired = false; strategyState = StrategyState.Empty; state.IfSome(shutdownFn); DisposeState(); sys.DispatchTerminate(Id); return(unit); } }
/// <summary> /// Shutdown everything from this node down /// </summary> public Unit Shutdown(bool maintainState) { lock (sync) { if (maintainState == false && Flags != ProcessFlags.Default) { cluster.IfSome(c => { // TODO: Make this transactional // { c.DeleteMany( StateKey, ActorInboxCommon.ClusterUserInboxKey(Id), ActorInboxCommon.ClusterSystemInboxKey(Id), ActorInboxCommon.ClusterMetaDataKey(Id), ActorInboxCommon.ClusterSettingsKey(Id)); sys.DeregisterById(Id); // } sys.Settings.ClearInMemorySettingsOverride(ActorInboxCommon.ClusterSettingsKey(Id)); }); } RemoveAllSubscriptions(); publishSubject.OnCompleted(); stateSubject.OnCompleted(); remoteSubsAcquired = false; strategyState = StrategyState.Empty; DisposeState(); sys.DispatchTerminate(Id); return(unit); } }
public override Unit Run(ProcessId pid) => ActorContext.System(pid).Settings.ClearSettingsOverride(ActorInboxCommon.ClusterSettingsKey(pid), Flags);
public override Unit Run(ProcessId pid) => ActorContext.System(pid).Settings.WriteSettingOverride(ActorInboxCommon.ClusterSettingsKey(pid), Value, Name, Prop, Flags);