Interface IStatefulOperator
Stateful operators shold consider implementing this interface so they can participate in state persistence (checkpointing) and recovery.
Checkpoint sequence:
- SaveState
- OnStateSaved
Recovery sequence:
- SetContext
- LoadState
- Start
Inherited Members
Namespace: Reaqtive
Assembly: Reaqtive.Interfaces.dll
Syntax
public interface IStatefulOperator : IOperator, IDisposable, IVersioned
Properties
StateChanged
True if the state has changes since the last time it was saved and false otherwise. This flag can be used to avoid saving the state of the operator unnecessary. Operators might choose not to implement this and always return true.
Declaration
bool StateChanged { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
LoadState(IOperatorStateReader, Version)
Called to load the operator's state from a previously persisted snapshot.
Declaration
void LoadState(IOperatorStateReader reader, Version version)
Parameters
Type | Name | Description |
---|---|---|
IOperatorStateReader | reader | Reader to read operator state from. |
System.Version | version | Version of the state being loaded. |
OnStateSaved()
Called after a checkpoint (persisting the states of multiple operators) has completed and before any new incoming events are received. Operators can update/trim their state in this method.
Declaration
void OnStateSaved()
SaveState(IOperatorStateWriter, Version)
Called to persist a snapshot of the operator's state.
Declaration
void SaveState(IOperatorStateWriter writer, Version version)
Parameters
Type | Name | Description |
---|---|---|
IOperatorStateWriter | writer | Writer to write operator state to. |
System.Version | version | Version of the state being saved. |