@pwngh/economy-lab
    Preparing search index...

    Interface MovementJournal

    The append-only session-netting journal. A batch commits in one transaction (one fsync for N movements), and journal rows carry no locks, chain links, or balance updates. A duplicate idempotency key or (sessionId, seq) rejects the batch; the session splits and retries around the poison row.

    interface MovementJournal {
        append(
            movements: readonly Movement[],
            options?: CallOptions,
        ): Promise<void>;
        bySession(
            sessionId: string,
            options?: CallOptions,
        ): AsyncIterable<Movement>;
        pruneSession?(sessionId: string, options?: CallOptions): Promise<number>;
        sessionIds?(options?: CallOptions): AsyncIterable<string>;
    }
    Index
    • Streams a session's movements in seq order — the source of truth settle derives from.

      Parameters

      Returns AsyncIterable<Movement>

    • Retention (src/worker/retention.ts): deletes every one of the session's rows, returning the count, and frees their idempotency keys and (sessionId, seq) positions. Only for a session whose settlement evidence verified — the sweep checks before calling; pruned history is gone from reads and from sessionIds. Optional; a store without it skips the session retention lane.

      Parameters

      Returns Promise<number>

    • Streams every distinct session id present in the journal — the orphan sweep's enumeration (src/worker/orphans.ts): a session with journaled movements and no settlement posting is an orphan candidate. Optional; a store without it cannot host the sweep.

      Parameters

      Returns AsyncIterable<string>