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

    Interface Store

    The full set of stores the system reads and writes.

    Storage for the sub-stores, the outbox/inbox, and the adapters.

    interface Store {
        accruals: AccrualStore;
        checkpoints: CheckpointStore;
        entitlements: EntitlementStore;
        idempotency: IdempotencyStore;
        inbox: InboxStore;
        ledger: Ledger;
        movements: MovementJournal;
        outbox: OutboxStore;
        promos: PromoStore;
        replay: ReplayStore;
        reservations?: ReservationStore;
        sagas: SagaStore;
        sales: SaleStore;
        subscriptions: SubscriptionStore;
        trust: TrustStore;
        batchTransaction?<T>(
            works: readonly ((unit: Unit) => Promise<T>)[],
            options?: CallOptions,
        ): Promise<BatchSlot<T>[]>;
        close(): Promise<void>;
        tableSizes?(options?: CallOptions): Promise<TableSizes>;
        transaction<T>(
            work: (unit: Unit) => Promise<T>,
            options?: CallOptions,
        ): Promise<T>;
    }
    Index
    accruals: AccrualStore
    checkpoints: CheckpointStore
    entitlements: EntitlementStore
    idempotency: IdempotencyStore
    inbox: InboxStore
    ledger: Ledger
    movements: MovementJournal

    The session-netting journal; it commits outside money transactions, so an accepted movement is durable regardless of any ledger posting's fate.

    outbox: OutboxStore
    promos: PromoStore
    replay: ReplayStore
    reservations?: ReservationStore

    The shared cross-node reservation counter behind multi-node netting (sharedReservations, src/netting.ts): one row per account, add folds a delta in atomically and returns the post-add pending total. Absent on stores that cannot host a shared counter (the HTTP edge adapter); the in-process registry remains the single-node default either way.

    sagas: SagaStore
    sales: SaleStore
    subscriptions: SubscriptionStore
    trust: TrustStore
    • Submit micro-batching support, optional: commits K work items for one fsync on the clean path while isolating failures per item — a failing item's slot carries its error and its writes roll back alone; its batch-mates still commit. Items run sequentially, and a later item can observe an earlier one's writes. How isolation is achieved is each engine's own strategy. Under any strategy an item can execute more than once across attempts — always fully rolled back in between — so the caller's idempotency keys make the replay exactly-once. When absent, callers fall back to one transaction per item.

      Type Parameters

      • T

      Parameters

      Returns Promise<BatchSlot<T>[]>

    • Releases the store's resources — the SQL engines end their connection pool. Terminal: no call on the store is valid after it.

      Returns Promise<void>

    • Row counts of the secondary tables the capacity report gauges — the growth surfaces retention governs. Optional; absent, those gauges read as unknown, never zero.

      Parameters

      Returns Promise<TableSizes>

    • Runs work in one database transaction: everything it writes commits together or not at all.

      Type Parameters

      • T

      Parameters

      Returns Promise<T>