@intisy/bayonet
    Preparing search index...

    Interface Store

    Key/value store of JSON strings, keyed by file-like names. update must be atomic; that is the implementation's concern.

    The key examples this once carried named plugin categories, which the contract may not know, and became visible to that gate the moment this interface started emitting TypeScript.

    interface Store {
        delete(key: string): void;
        exists(key: string): boolean;
        get(key: string): string;
        listKeys(prefix: string): string[];
        put(key: string, value: string): void;
        update(key: string, mutator: (value: string) => string): void;
    }
    Index
    • Removes key, and does nothing when it holds nothing.

      Parameters

      • key: string

        the entry's name

      Returns void

    • Whether anything is stored under key.

      Parameters

      • key: string

        the entry's name

      Returns boolean

      true when an entry is stored under key, false when there is none

    • The value stored under key, or null when nothing is stored there.

      Parameters

      • key: string

        the entry's name

      Returns string

      the stored value, or null when nothing is stored under key

    • Every key beginning with prefix, in the order the store holds them.

      Parameters

      • prefix: string

        the key prefix to match, or an empty string to match every key

      Returns string[]

      the matching keys, or an empty list when none match

    • Stores value under key, replacing whatever was there.

      Parameters

      • key: string

        the entry's name

      • value: string

        the value to store

      Returns void

    • Replaces key's value with what mutator returns, reading and writing as one step, and hands the mutator null when the key holds nothing yet.

      Parameters

      • key: string

        the entry's name

      • mutator: (value: string) => string

        computes the new value from the current one

      Returns void