Setu-TS
    Preparing search index...

    Interface IIdempotencyStore

    The store port behind every idempotency entry point.

    The state machine a store implements is: a claim of an absent key is claimed; a claim whose stored fingerprint differs is fingerprint-mismatch; a claim of a completed record is completed with the record; a claim of an in-progress record inside its lease is in-progress, and after the lease lapses it is claimed with takeover: true. complete and release succeed only for the token that holds the claim.

    0.9.0

    interface IIdempotencyStore {
        maxRecordBytes?: number;
        name: string;
        claim(request: IdempotencyClaimRequest): Promise<IdempotencyClaimResult>;
        complete(
            key: string,
            token: string,
            record: string,
            ttlMs: number,
        ): Promise<IdempotencySettleResult>;
        connect(runtime: IRuntimeServices): Promise<void>;
        disconnect?(): Promise<void>;
        isHealthy?(): Promise<boolean>;
        release(key: string, token: string): Promise<IdempotencySettleResult>;
    }

    Implemented by

    Index
    maxRecordBytes?: number

    Largest serialized record in UTF-8 bytes the store can hold. Absent: no store limit.

    name: string

    Short store kind for health data, e.g. 'memory', 'redis', 'durable-object'.

    • Settles a held claim into a completed record.

      Parameters

      • key: string

        The store key

      • token: string

        The token that holds the claim

      • record: string

        The opaque record to store

      • ttlMs: number

        Milliseconds the record is retained from this write

      Returns Promise<IdempotencySettleResult>

      'settled' when the token still held the claim, else 'lost'

    • Releases the store's own resources. Called from the plugin's close hook.

      Returns Promise<void>

      A promise resolved once the store's resources are released