import type { AztecArray, AztecAsyncArray } from './array.js'; import type { Key, StoreSize, Value } from './common.js'; import type { AztecAsyncCounter, AztecCounter } from './counter.js'; import type { AztecAsyncMap, AztecMap } from './map.js'; import type { AztecAsyncMultiMap, AztecMultiMap } from './multi_map.js'; import type { AztecAsyncSet, AztecSet } from './set.js'; import type { AztecAsyncSingleton, AztecSingleton } from './singleton.js'; /** A key-value store */ export interface AztecKVStore { syncGetters: true; /** * Creates a new map. * @param name - The name of the map * @returns The map */ openMap(name: string): AztecMap; /** * Creates a new set. * @param name - The name of the set * @returns The set */ openSet(name: string): AztecSet; /** * Creates a new multi-map. * @param name - The name of the multi-map * @returns The multi-map */ openMultiMap(name: string): AztecMultiMap; /** * Creates a new array. * @param name - The name of the array * @returns The array */ openArray(name: string): AztecArray; /** * Creates a new singleton. * @param name - The name of the singleton * @returns The singleton */ openSingleton(name: string): AztecSingleton; /** * Creates a new count map. * @param name - name of the counter */ openCounter(name: string): AztecCounter; /** * Starts a transaction. All calls to read/write data while in a transaction are queued and executed atomically. * @param callback - The callback to execute in a transaction */ transaction>>(callback: () => T): Promise; /** * Clears all entries in the store */ clear(): Promise; /** * Deletes the store */ delete(): Promise; /** * Estimates the size of the store in bytes. */ estimateSize(): Promise; /** * Closes the store */ close(): Promise; } export interface AztecAsyncKVStore { /** * Creates a new map. * @param name - The name of the map * @returns The map */ openMap(name: string): AztecAsyncMap; /** * Creates a new set. * @param name - The name of the set * @returns The set */ openSet(name: string): AztecAsyncSet; /** * Creates a new multi-map. * @param name - The name of the multi-map * @returns The multi-map */ openMultiMap(name: string): AztecAsyncMultiMap; /** * Creates a new array. * @param name - The name of the array * @returns The array */ openArray(name: string): AztecAsyncArray; /** * Creates a new singleton. * @param name - The name of the singleton * @returns The singleton */ openSingleton(name: string): AztecAsyncSingleton; /** * Creates a new count map. * @param name - name of the counter */ openCounter(name: string): AztecAsyncCounter; /** * Starts a transaction. All calls to read/write data while in a transaction are queued and executed atomically. * @param callback - The callback to execute in a transaction */ transactionAsync>>(callback: () => Promise): Promise; /** Clears all entries in the store */ clear(): Promise; /** Deletes the store */ delete(): Promise; /** Estimates the size of the store in bytes. */ estimateSize(): Promise; /** Closes the store */ close(): Promise; /** Backups the store to the target folder.*/ backupTo(dstPath: string, compact?: boolean): Promise; }