UNPKG

@mooncake/contract

Version:

@mooncake/contract

21 lines (17 loc) 511 B
export interface ReadOnlyKvStore<K, V> { get (key: K): V | undefined has (key: K): boolean keys (): K[] } export interface KvStore<K, V> extends ReadOnlyKvStore<K, V> { set (key: K, value: V): void setIfAbsent (key: K, value: V): boolean delete (key: K): boolean clear (): void } export type AsyncReadOnlyKvStore<K, V> = { [k in keyof ReadOnlyKvStore<K, V>]: Promisify<ReadOnlyKvStore<K, V>[k]> } export type AsyncKvStore<K, V> = { [k in keyof KvStore<K, V>]: Promisify<KvStore<K, V>[k]> }