Skip to content

Documentation / @etherfold/browser / SyncingState

Type Alias: SyncingState<ABI> ​

SyncingState<ABI> = object

Defined in: packages/browser/src/IndexerState.ts:183

Type Parameters ​

ABI ​

ABI extends Abi

Properties ​

autoIndexing ​

autoIndexing: boolean

Defined in: packages/browser/src/IndexerState.ts:185


catchingUp ​

catchingUp: boolean

Defined in: packages/browser/src/IndexerState.ts:189


demotion? ​

optional demotion?: Demotion

Defined in: packages/browser/src/IndexerState.ts:262

THIS TAB IS NO LONGER A WRITER, and WHY -- or ABSENT while it still is.

The visible half of the demotion (demoteToReader): a writer whose mutation was refused, or that was told it lost the write duty, stops fetching and folding and goes on ANSWERING READS. Without this field an app following the documented createState example would get a tab that silently stopped indexing for ever, which is the quiet failure the writer guard exists to end.

It is its own field and NOT error, on exactly the ground streamSeed is: an app that renders error as a fault would render a crash for a state change, and acknowledgeError() does not fit an outcome nothing can acknowledge away. The data on screen is still correct -- it is the store's, and the store is being written by whoever holds it now -- so the honest rendering is "this tab is reading" rather than a broken app.

It is reported for the INDEXER and not per generation, because the claim it reports is a fact about one unit of STORAGE (ADR-0075) and the shipped pattern hands one store to every generation (ADR-0077): a demotion that applied to one generation of a shared store and not to its neighbours would be a claim no backend makes.

It CLEARS on dispose(), because a later init builds new generations over whatever the factories hand back -- which is where becoming a writer again happens, since a store that has lost is never re-claimed (ADR-0077).


election? ​

optional election?: TabElectionState

Defined in: packages/browser/src/IndexerState.ts:271

WHAT THE TAB ELECTION MADE OF THIS TAB, or ABSENT where the app did not opt in (ADR-0097). reader: another tab holds the lock and indexes, this one answers reads from the shared store, lastSync stays empty, and the leader's progress is on the port (mainThreadHost(), HostProgress). writer: this tab holds the lock and indexes, with tookOver once it became the writer after another tab went away.


error? ​

optional error?: object

Defined in: packages/browser/src/IndexerState.ts:192

code? ​

optional code?: number

id ​

id: ErrorCode

message ​

message: string


fetchingLogs ​

fetchingLogs: boolean

Defined in: packages/browser/src/IndexerState.ts:188


lastSync? ​

optional lastSync?: ExtendedLastSync<ABI>

Defined in: packages/browser/src/IndexerState.ts:191


loading ​

loading: boolean

Defined in: packages/browser/src/IndexerState.ts:186


nonCanonicalGenerations ​

nonCanonicalGenerations: readonly GenerationProgress[]

Defined in: packages/browser/src/IndexerState.ts:205

EVERY generation this indexer holds that is NOT answering reads, with how far each has caught up (story 5).

Empty while there is only one generation, which is the ordinary state of an app that has not reconfigured. A generation LEAVES this list the moment the canonical pointer names it -- it is then the thing being read, not a successor to it -- and the generation the pointer moved OFF enters it, because it is retained (that is what makes moving the pointer BACK a revert) and because "a generation you could revert to exists" is the same fact reported the same way.


numRequests? ​

optional numRequests?: number

Defined in: packages/browser/src/IndexerState.ts:190


processingFetchedLogs ​

processingFetchedLogs: boolean

Defined in: packages/browser/src/IndexerState.ts:187


publication? ​

optional publication?: PublicationState

Defined in: packages/browser/src/IndexerState.ts:235

WHAT THE PUBLICATION INDEX this hook was pointed at GAVE the generation it built at init, or ABSENT where no publication option was given (ADR-0095).

found names the snapshot createState was handed; refused says why there was none (no entry for this generation, an entry only for ANOTHER stream, or no index reachable at any location), and the tab indexes from the chain exactly as it does with no snapshot. Its own field and not error, on the ground streamSeed is: it is an ordinary outcome and never gates the boot. It reports the LOOKUP; the install is the app's openAndBootstrap outcome, and the seed's is streamSeed. See PublicationState.


streamSeed? ​

optional streamSeed?: StreamSeedState

Defined in: packages/browser/src/IndexerState.ts:222

WHAT HAPPENED TO THE STREAM SEED this hook was asked to install, or ABSENT where none was asked for.

Additive, and its own field rather than a second meaning for an existing one: an app that never seeds sees undefined here for ever and nothing else about this store changes. See StreamSeedState.

It reports the install THIS hook ran at init, into the stream the indexer was initialised on. A reconfigure that moves the indexer to a DIFFERENT stream does not re-run an install and does not clear this, so on that path it goes on describing the stream the app booted on -- which is the honest reading of a boot-time fact, and the reason it is not cleared alongside lastSync: the common reconfigure (a processor change) keeps the very stream this describes, and clearing there would drop a true report.


waitingForProvider ​

waitingForProvider: boolean

Defined in: packages/browser/src/IndexerState.ts:184