annotations-design-patterns
    Preparing search index...

    Interface VersionedAsyncStore<Value>

    Minimal async compare-and-set contract. Versions are opaque to callers.

    interface VersionedAsyncStore<Value> {
        capabilities: { compareExchange: true; ttl: true };
        read(key: string): Promise<VersionedStoreEntry<Value>>;
        compareExchange(
            key: string,
            expectedVersion: string,
            value: Value,
            ttlMs?: number,
        ): Promise<VersionedCompareExchangeResult<Value>>;
        deleteIfVersion(key: string, expectedVersion: string): Promise<boolean>;
    }

    Type Parameters

    • Value

    Implemented by

    Index
    capabilities: { compareExchange: true; ttl: true }
    • Parameters

      • key: string
      • expectedVersion: string

      Returns Promise<boolean>