RecoverableStateBaseOptions <TStateModel, TPersistedState>
Hierarchy
- RecoverableStatePersistenceOptions
- RecoverableStateBaseOptions
Index
Properties
optionalconfiguration
Configuration instance to use when opening the KeyValueStore
optionalcontentType
Content type of the persisted record. Setting it hands the record encoding over to
RecoverableStateBaseOptions.serialize and RecoverableStateBaseOptions.deserialize, both of
which are then required - the default JSON codec is bypassed in both directions. Meant for a state too large
for JSON.stringify, which serialize can then stream out instead.
defaultState
The state used when no persisted state is found, and the state RecoverableState.reset restores.
A plain value is deep-copied with structuredClone each time it is used, so pass a factory for a state
that structuredClone cannot rebuild - one holding class instances, say, or one derived from a schema.
optionaldeserialize
Optional conversion of a persisted value back to the state model, and the place to validate a record before trusting it. If not provided, the persisted value is used as is.
With RecoverableStateBaseOptions.contentType set, it receives a Readable of the record bytes
instead of a parsed value.
optionalinheritedkeyValueStore
The KeyValueStore to persist into, defaulting to the default store. Accepts a pending KeyValueStore.open so that callers do not have to be async to point at a specific store.
optionallogger
A logger instance for logging operations related to state persistence
optionalinheritedpersistenceEnabled
Flag to enable or disable state persistence
optionalinheritedpersistenceTimeoutMillis
Time limit for a single load or save of the state, in milliseconds.
inheritedpersistStateKey
The key under which the state is stored in the KeyValueStore
optionalserialize
Optional conversion of the state to a plain JSON-serializable value before it is persisted. If not provided, the state is persisted as is.
With RecoverableStateBaseOptions.contentType set, it has to produce what
KeyValueStore.setValue accepts alongside an explicit content type - a string, a Buffer or a
stream.
The fields of RecoverableStateOptions, without the constraint tying
contentTypeto the conversions.