Skip to content

Documentation / @etherfold/processor-entities / openAndBootstrap

Function: openAndBootstrap() ​

openAndBootstrap(store, locations, options): Promise<{ outcome: BootstrapOutcome; store: SnapshotAwareStateStore; }>

Defined in: packages/processor-entities/src/snapshot.ts:482

Open a store snapshot-aware and bootstrap it if it has never synced.

The convenience the boot path of an app actually wants, and it exists to make the SAFE order the short one: open through openSnapshotAware (which is what recovers a floor recorded by a previous run) and only then decide whether to fetch anything. A host that reached for store.bootstrap directly on a fresh handle would get the floor right today and lose it on the next reload.

A store that has already synced is left alone without a single request, which is the common case on every run after the first, UNLESS the caller asks for local state to be replaced (replaceLocal, ADR-0096): then the published snapshot is installed over it if it is further along, and the store is kept otherwise.

Parameters ​

store ​

StateStoreBackend

locations ​

SnapshotLocation | readonly SnapshotLocation[]

options ​

BootstrapOptions

Returns ​

Promise<{ outcome: BootstrapOutcome; store: SnapshotAwareStateStore; }>