Skip to content

Documentation / @etherfold/browser / generationAddress

Function: generationAddress() ​

generationAddress(name): object

Defined in: packages/browser/src/storage/generation/OnIndexedDB.ts:61

The registry's address under one indexer name: HIERARCHICAL array keys, in the same object store the streams live in.

['generation', <indexer-name>, 'canonical']                          a SLOT
['generation', <indexer-name>, 'successor']                          a SLOT
['generation', <indexer-name>, 'predecessor']                        a SLOT
['generation', <indexer-name>, 'entry', <streamDigest>, <processor>]  a generation
['generation', <indexer-name>, 'kept', <streamDigest>]               a STREAM this indexer holds

The two halves of a generation's identity are two KEY ELEMENTS and never one delimited string, for the reason the stream address is hierarchical (ADR-0036): elements compare element by element, so no rendering of one component can be read as another's. It also makes "every generation on this stream" -- what reaping asks -- a scoped range rather than a scan.

A SLOT IS ONE SMALL RECORD BESIDE THE ENTRIES and never a field on one, which is ADR-0084's rule expressed as an address: a slot is an ASSIGNMENT pointing at a generation, so the same content under two slots stays ONE entry, one keyspace and one fold. canonical was the first of them and is unchanged; successor and predecessor sit at the same level under their own names.

Each slot key sits OUTSIDE the entry range: the range's upper bound is [..., 'entry', []], which is below every key whose third element is another literal, so a scoped read of the generations picks up none of them whichever way the names happen to sort. That is the same trap the stream subtree's two ranges carry, and the same fix.

Parameters ​

name ​

string

Returns ​

canonical ​

canonical: IDBValidKey

entries ​

entries: IDBKeyRange

Every generation record under this name, and nothing else.

entry ​

entry: (id) => IDBValidKey

Parameters ​

id ​

GenerationId

Returns ​

IDBValidKey

kept ​

kept: (digest) => IDBValidKey

WHERE the record that this indexer holds one stream lives.

Parameters ​

digest ​

string

Returns ​

IDBValidKey

keptStreams ​

keptStreams: IDBKeyRange

Every stream record under this name, and nothing else. Same bound trick as entries.

prefix ​

prefix: IDBValidKey[]

slot ​

slot: (slot) => IDBValidKey

WHERE one slot's assignment lives. One record per slot per indexer, by construction.

Parameters ​

slot ​

"canonical" | "successor" | "predecessor"

Returns ​

IDBValidKey