Skip to content

Documentation / @etherfold/processor-entities / createSnapshot

Function: createSnapshot() ​

createSnapshot<ABI>(snapshot): Promise<StateSnapshot>

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

The MINIMAL producer: a format-2 document around rows a caller already has.

It exists so the consuming side can be tested against a real document rather than a hand-written literal, and it is honest about being that. It cannot read the rows out of a store for you, and the reason is structural rather than an omission: the seam has no "list everything" read and deliberately never will (a listing is anchored at a key prefix by construction, ADR-0021). The producer that DOES read a whole state is a backend's own (produceStateSnapshot, @etherfold/state-store-sqlite).

The snapshot carries no history (none): its floor is takenAt, and rows are the rows live there.

Type Parameters ​

ABI ​

ABI extends Abi

Parameters ​

snapshot ​

entities ​

readonly EntityDeclaration[]

The entities the rows belong to: the processor's declarations. A format-2 document writes each once, and every row as its values in that column order.

lastSync ​

LastSync<ABI>

The cursor those rows belong to. Serialized here, installed with them as one unit.

processor ​

string

WHICH FOLD computed the rows: its identity, compared for equality and never parsed.

It is the identity the producing deployment's ARRIVAL derived and that its generation is REGISTERED under (ADR-0086) -- the SHA-256 of the bundle's octets where a deployment read one off disk -- and it is HANDED here rather than computed, because the bytes a fold ran are the producer's fact and not this module's. Take it from the fold that wrote these rows (the canonical generation's processor) rather than deriving it a second way beside it: a label that names an artifact other than the one that folded is the silent wrong-state condition ADR-0086 exists to delete, arriving at a client that cannot detect it -- a snapshot-seeded generation is a LEAF with no stream to re-fold and no way to recover by re-indexing.

rows ​

Iterable<Mutation, any, any> | AsyncIterable<Mutation, any, any>

The LIVE rows at that block, as the upserts that reproduce them.

savedAt? ​

string

takenAt ​

BlockPointer

The block the rows are the state AS OF. Its number becomes the consumer's history floor.

Returns ​

Promise<StateSnapshot>