Skip to content

Documentation / @etherfold/browser / keepStreamOnIndexedDB

Function: keepStreamOnIndexedDB() ​

keepStreamOnIndexedDB<ABI>(name, options?): ExistingStream<ABI> & object

Defined in: packages/browser/src/storage/stream/OnIndexedDB.ts:231

The cached event stream, as an APPEND-ONLY log of segments in IndexedDB.

A save writes its BATCH as a new segment at the next ordinal, together with the cursor record, in ONE transaction, and nothing already written is ever touched again -- so appending costs the batch and not the history. The shipped keeper read the whole stream, concatenated and wrote all of it back on every saveNewEvents, which made a backfill quadratic and charged an EMPTY batch the same price purely to move lastSync.

The rules are @etherfold/core's createSegmentedStream; this module supplies the substrate: the address, the key ranges and the transaction. store is injectable so a test can WRAP the object store and count the work a save does, which is the only honest place to measure it now that the commit is a raw transaction rather than a call to set.

Type Parameters ​

ABI ​

ABI extends Abi

Parameters ​

name ​

string

options? ​

store? ​

UseStore

Returns ​

ExistingStream<ABI> & object