Skip to content

DurableGrain Methods

Provides a base class for grains which manage journaled durable state.

GetOrCreateState(string, Func<TArg, TState>, TArg)

View source
protected TState GetOrCreateState<TArg, TState>(string name, Func<TArg, TState> createState, TArg arg)
Gets the registered state with the specified name or creates it using the supplied factory and argument.

Parameters

namestring
The name used to register the state.
createStateFunc<TArg, TState>
The factory used to create the state when it is not already registered.
argTArg
The argument passed to createState.

Returns

The existing or newly created state.

GetOrCreateState(string)

View source
protected TState GetOrCreateState<TState>(string name)
Gets the registered state with the specified name or creates it using the grain service provider.

Parameters

namestring
The name used to register the state.

Returns

The existing or newly created state.

WriteStateAsync(CancellationToken)

View source
protected ValueTask WriteStateAsync(CancellationToken cancellationToken = default(CancellationToken))
Writes the registered journaled state.

Parameters

cancellationTokenCancellationToken
The cancellation token.

Returns

A System.Threading.Tasks.ValueTask representing the write operation.