Documentation / @etherfold/core / createMemoryGenerationRegistryPort
Function: createMemoryGenerationRegistryPort() ​
createMemoryGenerationRegistryPort(
options?):GenerationRegistryPort
Defined in: packages/core/src/generation/memory.ts:41
THE REFERENCE SUBSTRATE for the generation registry: three collections in memory.
It is here for the same reason MemoryStateStore is at the storage seam -- the rules live over a PORT, and a port with only one real implementation is a claim nobody has checked. It is also what a runtime with no durable place to put the records uses: a container still needs a canonical pointer to resolve reads through, and a tab that holds ONE generation re-registers it on every boot anyway (create RESOLVES an already-registered generation), so a forgetful registry costs that runtime nothing.
What it does NOT do is survive a reload, so it is the wrong substrate for a deployment that keeps a superseded generation in order to move the pointer BACK to it. That one wants a durable port (openGenerationRegistryOnIndexedDB in @etherfold/browser).
commit applies the registry's decision to the state it was just handed, in one synchronous step, which is what an IndexedDB readwrite transaction and a SQL transaction give it for real. One JS heap has no second writer to race, so that is not a simplification here, it is the whole of the guarantee.
It reports NO stream subtrees, because it stores none: the streams a runtime keeps live in that runtime's keeper, under its own address. So the sweep finds nothing to collect here rather than pretending to have collected something -- a runtime that wants its orphan subtrees swept needs a registry port that can SEE them, which is exactly what the IndexedDB one is.
Parameters ​
options? ​
dropState? ​
(id) => Promise<void>
Drop the state store a deleted generation folded into. Nothing, by default.
readStateCursor? ​
(id) => Promise<number | undefined>
How far the fold in one generation's state got (lastToBlock), for a generation the asker holds no fold for. NOTHING READABLE, by default.
The same injection dropState is, for the same reason: this substrate holds the RECORDS and knows nothing about where a caller kept the state. A caller that supplies none is saying its generations' positions cannot be read from outside a fold, and the promotion trigger then moves no pointer on its own -- which is the safe direction, and never a zero (see the port's JSDoc).