Skip to content

IJournaledStateManager Methods

Owns journal recovery and persistence for registered state machines.

DeleteStateAsync(CancellationToken)

abstract
public abstract ValueTask DeleteStateAsync(CancellationToken cancellationToken = default(CancellationToken))
Resets this instance, removing any persistent state.

Parameters

cancellationTokenCancellationToken
The cancellation token.

Returns

A System.Threading.Tasks.ValueTask which represents the operation.

InitializeAsync(CancellationToken)

abstract
public abstract ValueTask InitializeAsync(CancellationToken cancellationToken = default(CancellationToken))
Initializes the state manager by replaying its journal.

Parameters

cancellationTokenCancellationToken
The cancellation token.

Returns

A System.Threading.Tasks.ValueTask which represents the operation.

RegisterStateMachine(string, IStateMachine)

abstract
public abstract void RegisterStateMachine(string name, IStateMachine stateMachine)
Registers a state machine before initialization begins.

Parameters

namestring
The state machine's stable identifier.
stateMachineIStateMachine
The state machine instance to register.

Exceptions

System.InvalidOperationException
Initialization has begun or the name is already registered.

TryGetStateMachine(string, IStateMachine?)

abstract
public abstract bool TryGetStateMachine(string name, out IStateMachine? stateMachine)
Attempts to retrieve a registered state machine.

Parameters

namestring
The state machine's stable identifier.
stateMachineIStateMachine?
The registered state machine, if found.

Returns

true if the state machine is registered; otherwise, false.

WriteStateAsync(CancellationToken)

abstract
public abstract ValueTask WriteStateAsync(CancellationToken cancellationToken = default(CancellationToken))
Persists pending changes from the registered state machines to the journal.

Parameters

cancellationTokenCancellationToken
The token used to cancel the caller's wait.

Returns

A task representing the write acknowledgement.