Skip to content

Documentation / @etherfold/core / fetcherOf

Function: fetcherOf() ​

fetcherOf(generations, stream): GenerationRecord | undefined

Defined in: packages/core/src/generation/registry.ts:741

WHICH generation a stream was FETCHED FOR: the OLDEST SURVIVING one registered on it.

It is an ANSWER and no longer a DUTY on the receiving side (ADR-0087) ​

It was writerOf, and it ELECTED the one generation per stream that held the pen: the appender was handed to whichever fold this named and to nothing else. That third role does not belong to a generation at all, and electing it by registration ORDER is what produced the measured data-loss defect -- the elected writer can be a generation the process holds no fold for, so the duty belonged to something absent while a present fold folded happily.

So the ELECTION is gone: on the receiving side the DEPLOYMENT fetches a stream and appends to it, positioned from the STREAM's own coverage claim, and every generation merely READS it. What survives here is the question ADR-0087 says may survive -- which generation was this stream fetched for -- which is still the oldest surviving record on it, still derived, still stored nowhere, and still atomic with a delete. Nothing may read it as permission to append.

The CHAIN-FACING container still derives follows from it, and that is the same question rather than the retired one: there the engine that fetches a stream IS a generation (IndexerGeneration opens load() with eth_chainId), so "which generation fetched this" and "which generation writes this" are one fact, and ADR-0044's follower rule is untouched.

undefined means no registered generation folds this stream. That is no longer a reason to delete anything: the stream is KEPT (GenerationRegistryState.keptStreams).

Parameters ​

generations ​

readonly GenerationRecord[]

stream ​

string

Returns ​

GenerationRecord | undefined