Show / Hide Table of Contents

Interface IStatefulOperator

Stateful operators shold consider implementing this interface so they can participate in state persistence (checkpointing) and recovery.

Checkpoint sequence:

  1. SaveState
  2. OnStateSaved

Recovery sequence:

  1. SetContext
  2. LoadState
  3. Start
Inherited Members
IOperator.Subscribe()
IOperator.SetContext(IOperatorContext)
IOperator.Start()
IOperator.Inputs
IVersioned.Name
IVersioned.Version
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.

In This Article
Back to top Generated by DocFX