Skip to main content

Class: OvercastIndexer

Defined in: packages/overcast-core/src/indexer/indexer.ts:27

Drives the store off the chain through three independent, self-healing loops:

  • backfill — a one-shot historical sweep from the head down to startCheckpoint (genesis by default), persisting its cursor so an interrupted run resumes instead of restarting.
  • runLive — a perpetual tail of the confirmed head: low latency, but folds transactions that could still be reorged away.
  • runFinalization — a perpetual tail of the finalized head: it re-sweeps each newly settled range so the store converges on the canonical chain even if the live tail missed or mis-folded a confirmed transaction.

Every loop tolerates errors: a failing tick is logged and retried on the next interval rather than tearing the indexer down. Inserts are idempotent, so the overlapping ranges the three loops cover are harmless.

The backfill and the finalization tail persist separate checkpoints (keyed by CheckpointKind): the backfill's is a descending paging cursor, the finalization tail's an ascending frontier — sharing a slot would let each clobber the other's resume point.

Constructors

Constructor

new OvercastIndexer(
client,
storage,
startCheckpoint?,
chunckSize?,
sleepInterval?): OvercastIndexer;

Defined in: packages/overcast-core/src/indexer/indexer.ts:35

Parameters

ParameterTypeDefault value
clientOvercastIndexerClientundefined
storageOvercastStoreundefined
startCheckpointCheckpoint | nullnull
chunckSizenumber500
sleepIntervalnumber500

Returns

OvercastIndexer

Properties

chunckSize

chunckSize: number;

Defined in: packages/overcast-core/src/indexer/indexer.ts:32


indexer

indexer: OvercastIndexerClient;

Defined in: packages/overcast-core/src/indexer/indexer.ts:28


sleepInterval

sleepInterval: number;

Defined in: packages/overcast-core/src/indexer/indexer.ts:33


startCheckpoint

startCheckpoint: Checkpoint | null;

Defined in: packages/overcast-core/src/indexer/indexer.ts:31

Floor of the backwards search — normally genesis (null).


storage

storage: OvercastStore;

Defined in: packages/overcast-core/src/indexer/indexer.ts:29

Methods

backfill()

backfill(head?): Promise<void>;

Defined in: packages/overcast-core/src/indexer/indexer.ts:80

Sweeps the chain from head (the current finalized head when not given) down to startCheckpoint (genesis by default). Resumes from the last stored checkpoint so an interrupted backfill keeps walking downwards instead of starting over. Persists the paging cursor after every page.

head should be the same snapshot the finalization tail was seeded with, so the two ranges meet exactly (see start).

Parameters

ParameterType
head?Checkpoint

Returns

Promise<void>


start()

start(): Promise<void>;

Defined in: packages/overcast-core/src/indexer/indexer.ts:55

Starts every loop and keeps indexing regardless of failures. The historical backfill runs in the background (retried until it reaches the start checkpoint); the live and finalization tails run forever. This method never resolves under normal operation — the tails loop indefinitely.

Returns

Promise<void>