export type KV = { key: string; value: any; }; /** * An interface to any simple key-value store. */ export interface KVStore { /** * Deletes the value associated with a given key. */ del(key: string): Promise; /** * Deletes all keys that start with a specific prefix. */ deletePrefix(prefix: string): Promise; /** * Deletes all keys in the store. */ deleteAll(): Promise; /** * Sets the value for a given key. */ set(key: string, value: any): Promise; /** * Sets the values for a list of key-value pairs. */ batchSet(kvs: KV[]): Promise; /** * Deletes a list of keys. */ batchDelete(keys: string[]): Promise; /** * Gets the values for a list of keys. */ batchGet(keys: string[]): Promise<(any | undefined)[]>; /** * Gets the value for a given key. */ get(key: string): Promise; /** * Checks whether a given key exists in the store. */ has(key: string): Promise; /** * Gets all key-value pairs where the key starts with a specific prefix. */ queryPrefix(keyPrefix: string): Promise<{ key: string; value: any }[]>; }