import { Await, AwaitIterable, AbortOptions } from './basic'; export interface ValueStore { get(options?: AbortOptions): Await; set(value: T): Await; } export interface KeyValueStore extends StoreReader, StoreExporter, StoreSelector, StoreLookup, StoreWriter, StoreImporter, StoreEraser { } export interface StoreReader { /** * The key retrieve the value for. */ get(key: Key, options?: AbortOptions): Await; } export interface StoreLookup { /** * Check for the existence of a given key */ has(key: Key, options?: AbortOptions): Await; } export interface StoreExporter { /** * Retrieve a stream of values stored under the given keys. */ getMany(keys: AwaitIterable, options?: AbortOptions): AwaitIterable; } export interface StoreSelector { /** * Search the store for some values. */ query(query: Query, options?: AbortOptions): AwaitIterable; } export interface StoreWriter { /** * Store a value with the given key. */ put(key: Key, value: Value, options?: AbortOptions): Await; } export interface StoreImporter { /** * Store many key-value pairs. */ putMany(entries: AwaitIterable, options?: AbortOptions): AwaitIterable; } export interface StoreEraser { /** * Delete the content stored under the given key. */ delete(key: Key, options?: AbortOptions): Await; /** * Delete the content stored under the given keys. */ deleteMany(keys: AwaitIterable, options?: AbortOptions): AwaitIterable; } export interface StoreBatch { batch(): Batch; } export interface Batch { put(key: Key, value: Value): void; delete(key: Key): void; commit(options?: AbortOptions): Await; } export interface Resource { /** * Opens the datastore, this is only needed if the store was closed before, * otherwise this is taken care of by the constructor. */ open(): Await; /** * Close the datastore, this should always be called to ensure resources * are cleaned up. */ close(): Await; } export interface Query { /** * Only return values where the key starts with this prefix */ prefix?: string; /** * Filter the results according to the these functions */ filters?: Array<(resut: Entry) => boolean>; /** * Order the results according to these functions */ orders?: Array<(results: Entry[]) => Entry[]>; /** * Only return this many records */ limit?: number; /** * An options object, all properties are optional */ options?: Options; /** * A way to signal that the caller is no longer interested in the outcome of * this operation */ signal?: AbortSignal; } //# sourceMappingURL=store.d.ts.map