Marmot-TS
    Preparing search index...

    The retained group history tree (Marmot v2 full-fork history). Holds every retained group state — the canonical branch and eligible forks — as a tree of ClientState snapshots linked by commit edges. Settled retention publishes authoritative membership before removing obsolete physical keys.

    The light index (per-node epoch/parent/edge metadata) is always resident. Heavy material (serialized snapshots + commit bytes) is kept in a bounded in-memory LRU and otherwise fetched from a backing key-value store on demand, so memory stays bounded even as the tree grows without limit. Newly recorded nodes are pinned in memory until flush persists them.

    Snapshots are stored as bytes, never as live ClientState objects: ts-mls zeroes a parent state's consumed secrets in place when a commit is processed from it, so a retained live object could be corrupted out from under a sibling-branch replay. Re-deriving a state (stateAt) decodes a fresh, independent object every call.

    Index
    • get rootTag(): string | undefined

      Logical retained root tag, or undefined if empty.

      Returns string | undefined

    • Ancestor tags of a node, nearest-first (excludes the node itself).

      Parameters

      • tag: string

      Returns string[]

    • Binds a backing store to a fresh, in-memory tree so its nodes can be flushed and its heavy material later evicted/reloaded. Marks every current node dirty so the first flush persists the whole tree. A no-op if the same store is already bound (e.g. on a tree loaded via load).

      Parameters

      Returns void

    • Child tags of a node (empty for a tip or an absent node).

      Parameters

      • tag: string

      Returns string[]

    • The serialized commit bytes that produced a node, or undefined.

      Parameters

      • childTag: string

      Returns Promise<Uint8Array<ArrayBufferLike> | undefined>

    • Decodes the commit MlsMessage that produced a node, or undefined.

      Parameters

      • childTag: string

      Returns Promise<MlsMessage | undefined>

    • The epoch of a node, or undefined if absent.

      Parameters

      • tag: string

      Returns number | undefined

    • Persists all unflushed nodes incrementally: each dirty node's light edge record, snapshot, and commit bytes are written under its own keys, plus the meta (root) record. Append-only — already-persisted nodes are untouched, so a save costs O(new nodes), not O(tree). Requires a bound store.

      Returns Promise<void>

    • Whether a node with tag exists.

      Parameters

      • tag: string

      Returns boolean

    • Whether a node is a tip (exists and has no children).

      Parameters

      • tag: string

      Returns boolean

    • The lowest common ancestor of two nodes (the fork point), or undefined if they share no ancestor (e.g. live in different trees).

      Parameters

      • a: string
      • b: string

      Returns string | undefined

    • All node tags sitting at epoch.

      Parameters

      • epoch: number

      Returns string[]

    • Oldest epoch still named by the tree, or undefined when it is empty.

      Returns number | undefined

    • The parent tag of a node, or undefined for the root / absent node.

      Parameters

      • tag: string

      Returns string | undefined

    • The path from the root to tag (inclusive of both), or undefined if the node is absent or its chain to the root is broken.

      Parameters

      • tag: string

      Returns string[] | undefined

    • Records a commit applied from a retained parent node to its resulting child state, adding (or linking) the child node. Idempotent on the child tag: a duplicate commit re-links without overwriting. Throws if the parent is not already in the tree.

      Parameters

      Returns string

      the child node tag.

    • Records an edge from a snapshot captured at branch-build time. Unlike recordCommit, the child snapshot is supplied pre-serialized — fork recovery serializes each branch state the instant it is produced, before ts-mls can zero that state's secrets when exploring its children. Idempotent on the child tag. Returns false (without recording) when the parent is not yet in the tree, so a batch can skip a dangling edge instead of throwing.

      Parameters

      Returns boolean

    • The serialized ClientState snapshot bytes for a node, or undefined if absent. Served from the in-memory cache, else fetched from the store.

      Parameters

      • tag: string

      Returns Promise<Uint8Array<ArrayBufferLike> | undefined>

    • Rehydrates a node's state into a fresh, independent ClientState, or undefined if no snapshot is retained. Each call decodes a new object, so callers may mutate/advance it without affecting the tree.

      Parameters

      • tag: string

      Returns Promise<ClientState | undefined>

    • All tip tags (leaf states) — the candidate branches for convergence.

      Returns string[]

    • Replaces a node's retained snapshot — used after staging a proposal onto a node, which updates its unappliedProposals without advancing the epoch. The new state's confirmation tag MUST equal the node tag (staging a proposal does not change it). Throws if the node is absent or the tag would change.

      Parameters

      Returns void

    • Loads a tree's light index from a store (heavy material stays lazy). Returns undefined if no tree is persisted under gid. The store stays bound, so snapshots/commit bytes are fetched on demand.

      Parameters

      • store: GenericKeyValueStore<Uint8Array<ArrayBufferLike>>
      • gid: string
      • Optionaloptions: { snapshotCacheSize?: number }

      Returns Promise<GroupHistoryTree | undefined>