Skip to content

FileGrainStorage Methods

Stores grain state as files in a configured directory.

ClearStateAsync(string, GrainId, IGrainState<T>)

View source
public Task ClearStateAsync<T>(string stateName, GrainId grainId, IGrainState<T> grainState)
Delete / Clear data function for this storage instance.

Parameters

stateNamestring
Name of the state for this grain
grainIdGrainId
Grain ID
grainStateIGrainState<T>
Copy of last-known state data object for this grain.

Returns

Completion promise for the Delete operation on the specified grain.

Exceptions

System.ArgumentNullException
grainState is null.

Participate(ISiloLifecycle)

View source
public void Participate(ISiloLifecycle lifecycle)
Adds the provided observer as a participant in the lifecycle.

Parameters

lifecycleISiloLifecycle
The observer.

ReadStateAsync(string, GrainId, IGrainState<T>)

View source
public Task ReadStateAsync<T>(string stateName, GrainId grainId, IGrainState<T> grainState)
Read data function for this storage instance.

Parameters

stateNamestring
Name of the state for this grain
grainIdGrainId
Grain ID
grainStateIGrainState<T>
State data object to be populated for this grain.

Returns

Completion promise for the Read operation on the specified grain.

Exceptions

System.ArgumentNullException
grainState is null.

WriteStateAsync(string, GrainId, IGrainState<T>)

View source
public Task WriteStateAsync<T>(string stateName, GrainId grainId, IGrainState<T> grainState)
Write data function for this storage instance.

Parameters

stateNamestring
Name of the state for this grain
grainIdGrainId
Grain ID
grainStateIGrainState<T>
State data object to be written for this grain.

Returns

Completion promise for the Write operation on the specified grain.

Exceptions

System.ArgumentNullException
grainState is null.