Marmot-TS
    Preparing search index...

    Interface RetainedHistoryStore

    The bounded convergence window — the recent canonical states + applied commits the convergence hot path needs to rebuild candidate branches and recover from forks and late delivery (Marmot v2 protocol-core/retained-history.md).

    Holds, keyed by epoch number:

    • the canonical ClientState at each retained epoch (the parent for the next commit), and
    • the commit message applied to advance from each source epoch on our current canonical branch.

    Both maps are bounded to the rollback horizon (max_rewind_commits): material older than tip - maxRewindCommits is pruned on every record. This is a purely in-memory, derived index: it is never persisted (the full-fork GroupHistoryTree is the single persisted source) and is rebuilt from the tree's canonical path on load.

    interface RetainedHistoryStore {
        get size(): number;
        anchorEpoch(): number | undefined;
        appliedCommitsBetween(forkEpoch: number, tipEpoch: number): MlsMessage[];
        appliedLinksBetween(
            forkEpoch: number,
            tipEpoch: number,
        ): RetainedAppliedLink[];
        hasState(epoch: number): boolean;
        record(
            parentState: ClientState,
            appliedMessage: MlsMessage,
            newState: ClientState,
            pinnedEpochs?: Iterable<number>,
            ownCommitStamp?: OwnCommitConvergenceStamp,
        ): void;
        stateAt(epoch: number): ClientState | undefined;
        states(): IterableIterator<ClientState>;
        tipEpoch(): number | undefined;
    }
    Index
    • Parent-bound applied links on the current canonical branch. Unlike a digest plus later epoch lookups, each entry keeps the exact parent state (including proposal-reference evidence) beside its resulting state.

      Parameters

      • forkEpoch: number
      • tipEpoch: number

      Returns RetainedAppliedLink[]

    • Records the retained parent state and the applied commit message after advancing an epoch, then prunes retained material beyond the rollback horizon (retained-history.md).

      pinnedEpochs are epochs the caller's active lifecycle still needs and that MUST NOT be pruned even when older than the horizon (retained-history.md "Pruning": state needed to resolve an active PendingPublish / Merging / Recovering / Unrecoverable). The engine supplies them; e.g. the source epoch of a staged local commit the canonical tip has since advanced past.

      Parameters

      • parentState: ClientState
      • appliedMessage: MlsMessage
      • newState: ClientState
      • pinnedEpochs: Iterable<number> = []
      • OptionalownCommitStamp: OwnCommitConvergenceStamp

      Returns void