Skip to content

Documentation / @etherfold/processor-entities / StateFactoriesOptions

Type Alias: StateFactoriesOptions ​

StateFactoriesOptions = object

Defined in: packages/processor-entities/src/stateFactories.ts:77

Properties ​

entities? ​

readonly optional entities?: readonly EntityDeclaration[]

Defined in: packages/processor-entities/src/stateFactories.ts:101

The declarations, for a processor IMPORTED as a module. Unused when the host hands a published bundle, whose own processor's entities are what the fold that writes the store declares.


fetch? ​

readonly optional fetch?: typeof globalThis.fetch

Defined in: packages/processor-entities/src/stateFactories.ts:105

openAndBootstrap's fetch: injectable for tests and for a host with its own retry policy.


finalityDepth? ​

readonly optional finalityDepth?: number

Defined in: packages/processor-entities/src/stateFactories.ts:103

openAndBootstrap's finalityDepth: a snapshot inside this reorg window is declined.


onBootstrap? ​

readonly optional onBootstrap?: (outcome, context) => void

Defined in: packages/processor-entities/src/stateFactories.ts:115

Told what the bootstrap did, each time the writer is handed a snapshot: a refusal is DATA ({status: 'not-bootstrapped', reason}), so an app that renders or logs it does so here.

An observer and nothing more: an error it throws is logged and swallowed, so a bug in the app's rendering never stops the writer from claiming a store that installed correctly.

Parameters ​

outcome ​

BootstrapOutcome

context ​

GenerationContext

Returns ​

void


open ​

readonly open: (context, entities) => StateStoreBackend | Promise<StateStoreBackend>

Defined in: packages/processor-entities/src/stateFactories.ts:92

THE ONE STORE CONSTRUCTOR both factories open: the storage a generation's state lives in, built and not yet claimed. Handed the declarations to build it with (the bundle's own, or entities), so the store is always declared from the fold that writes it.

ts
open: (context, entities) => createBrowserStateStore(entities, {databaseName: `app-${context.stream}`}),

Called ONCE per factory call, by the writer and by the reader alike, which is the whole point: the reader opens the database the leader writes because there is only one place that names it.

Parameters ​

context ​

GenerationContext

entities ​

readonly EntityDeclaration[]

Returns ​

StateStoreBackend | Promise<StateStoreBackend>