Setu-TS
    Preparing search index...

    Interface IInboxStore

    The inbox store port.

    Every method returns a promise that REJECTS on failure and never throws synchronously. Every read requires kind to equal INBOX_RECORD_KIND, and a row of another kind is treated as missing; a custom store must honour both rules.

    0.9.0

    interface IInboxStore {
        find(markerId: string): Promise<InboxRecord | undefined>;
        park(marker: InboxRecord): Promise<"exists" | "applied">;
        parked(limit: number): Promise<readonly InboxRecord[]>;
        purge(before: number, limit: number): Promise<number>;
        recordFailure(ids: InboxIds, update: InboxFailureUpdate): Promise<number>;
        release(
            ids: InboxIds,
            action: "retry" | "discard",
            now: number,
        ): Promise<InboxReleaseOutcome>;
        run<R>(
            marker: InboxRecord,
            work: (scope: unknown) => Promise<R>,
        ): Promise<R>;
        stats(): Promise<InboxStoreStats>;
        verify(): Promise<void>;
    }
    Index
    • Deletes rows of every status — processed, discarded, attempting and parked — last written before before, at most limit per status. A parked marker is purged like any other, so no row outlives the window while the caller's purge rate keeps up with inflow.

      Parameters

      • before: number

        Epoch milliseconds; rows with updatedAt < before are deleted

      • limit: number

        Maximum rows deleted per status

      Returns Promise<number>

      The number of rows deleted (a row already gone counts zero)

    • Releases a parked marker: retry deletes it and the failure-count row; discard marks it discarded, clears its envelope and deletes the failure-count row.

      Parameters

      • ids: InboxIds

        The delivery's row ids

      • action: "retry" | "discard"

        retry or discard

      • now: number

        Epoch milliseconds

      Returns Promise<InboxReleaseOutcome>

      applied with the marker as it was, missing, or not-parked

    • Opens ONE transaction, creates the marker in it FIRST, then runs work with the transaction's unit of work, and commits. Any rejection rolls the whole transaction back — the marker included — and propagates.

      Type Parameters

      • R

      Parameters

      • marker: InboxRecord

        The processed marker to create

      • work: (scope: unknown) => Promise<R>

        The handler, given the unit of work

      Returns Promise<R>

      What work resolved to

    • Refuses, at startup, a backend that cannot serve the inbox.

      Returns Promise<void>

      A promise that rejects naming why the store cannot serve