Documentation / @etherfold/processor-entities / openSnapshotAware
Function: openSnapshotAware() ​
openSnapshotAware(
store):Promise<SnapshotAwareStateStore>
Defined in: packages/state-store/dist/snapshot.d.ts:348
Open a store as one that may have been bootstrapped, recovering its floor.
This is the call that has to be on the boot path rather than only on the install path: the snapshot origin is persisted (see SnapshotOrigin) precisely so that the SECOND run of an app is as honest as the first, and a handle constructed without reading it back would report unbounded over rows whose history begins a million blocks up.
It MIGRATES the store on the way, because it has to read from it and a store that has not been migrated has nothing to read from (migrate is idempotent on every backend and is meant to be safe on every boot). That also means this is a complete replacement for the migrate() a host would otherwise call itself, rather than one more step to remember.
A corrupt marker throws rather than being treated as "never bootstrapped". The recovery from a corrupt sync cursor is a fresh sync, which is why THAT one is swallowed; the recovery from a corrupt origin is unknowable, because the rows in the store might have come from anywhere, and the safe reading of "I cannot tell whether this state has history" is not "assume it does".
Parameters ​
store ​
Returns ​
Promise<SnapshotAwareStateStore>