ActorLogic <TSnapshot, TEvent, TInput, TSystem>
Implemented by
Index
Properties
optionalconfig
The initial setup/configuration used to create the actor logic.
getInitialSnapshot
Type declaration
Called to provide the initial state of the actor.
Parameters
actorScope: ActorScope<TSnapshot, TEvent, TSystem>
The actor scope.
input: TInput
The input for the initial state.
Returns TSnapshot
The initial state.
getPersistedSnapshot
Type declaration
Obtains the internal state of the actor in a representation which can be be persisted. The persisted state can be restored by
restoreSnapshot
.Parameters
snapshot: TSnapshot
The current state.
optionaloptions: unknown
Returns Snapshot<unknown>
The a representation of the internal state to be persisted.
optionalrestoreSnapshot
Type declaration
Called when Actor is created to restore the internal state of the actor given a persisted state. The persisted state can be created by
getPersistedSnapshot
.Parameters
persistedState: Snapshot<unknown>
The persisted state to restore from.
actorScope: ActorScope<TSnapshot, TEvent, AnyActorSystem>
The actor scope.
Returns TSnapshot
The restored state.
optionalstart
Type declaration
Called when the actor is started.
Parameters
snapshot: TSnapshot
The starting state.
actorScope: ActorScope<TSnapshot, TEvent, AnyActorSystem>
The actor scope.
Returns void
transition
Type declaration
Transition function that processes the current state and an incoming message to produce a new state.
Parameters
snapshot: TSnapshot
The current state.
message: TEvent
The incoming message.
actorScope: ActorScope<TSnapshot, TEvent, TSystem>
The actor scope.
Returns TSnapshot
The new state.
Represents logic which can be used by an actor.