import { KeyValuePair, ScanStorageArgs, WriteOps } from "../../storage/types"; import { FilterTupleValuePairByPrefix, RemoveTupleValuePairPrefix, TuplePrefix, ValueForTuple } from "../typeHelpers"; import { ScanArgs, TxId, Unsubscribe } from "../types"; /** The low-level API for implementing new storage layers. */ export type AsyncTupleStorageApi = { scan: (args?: ScanStorageArgs) => Promise; commit: (writes: WriteOps) => Promise; close: () => Promise; }; /** Wraps AsyncTupleStorageApi with reactivity and MVCC */ export type AsyncTupleDatabaseApi = { scan: (args?: ScanStorageArgs, txId?: TxId) => Promise; commit: (writes: WriteOps, txId?: TxId) => Promise; cancel: (txId: string) => Promise; subscribe: (args: ScanStorageArgs, callback: AsyncCallback) => Promise; close: () => Promise; }; /** Wraps AsyncTupleDatabaseApi with types, subspaces, transaction objects, and additional read apis. */ export type AsyncTupleDatabaseClientApi = { commit: (writes: WriteOps, txId?: TxId) => Promise; cancel: (txId: string) => Promise; scan: >(args?: ScanArgs, txId?: TxId) => Promise[]>; subscribe: >(args: ScanArgs, callback: AsyncCallback>) => Promise; close: () => Promise; get: (tuple: T, txId?: TxId) => Promise | undefined>; exists: (tuple: T, txId?: TxId) => Promise; subspace:

>(prefix: P) => AsyncTupleDatabaseClientApi>; /** Arguments to transact() are for internal use only. */ transact: (txId?: TxId, writes?: WriteOps) => AsyncTupleRootTransactionApi; }; export type AsyncTupleRootTransactionApi = { scan: >(args?: ScanArgs) => Promise[]>; get: (tuple: T) => Promise | undefined>; exists: (tuple: T) => Promise; subspace:

>(prefix: P) => AsyncTupleTransactionApi>; set: (tuple: Key, value: ValueForTuple) => AsyncTupleRootTransactionApi; remove: (tuple: S["key"]) => AsyncTupleRootTransactionApi; write: (writes: WriteOps) => AsyncTupleRootTransactionApi; commit: () => Promise; cancel: () => Promise; id: TxId; writes: Required>; }; export type AsyncTupleTransactionApi = { scan: >(args?: ScanArgs) => Promise[]>; get: (tuple: T) => Promise | undefined>; exists: (tuple: T) => Promise; subspace:

>(prefix: P) => AsyncTupleTransactionApi>; set: (tuple: Key, value: ValueForTuple) => AsyncTupleTransactionApi; remove: (tuple: S["key"]) => AsyncTupleTransactionApi; write: (writes: WriteOps) => AsyncTupleTransactionApi; }; /** Useful for indicating that a function does not commit any writes. */ export type ReadOnlyAsyncTupleDatabaseClientApi = { scan: >(args?: ScanArgs, txId?: TxId) => Promise[]>; get: (tuple: T, txId?: TxId) => Promise | undefined>; exists: (tuple: T, txId?: TxId) => Promise; subspace:

>(prefix: P) => ReadOnlyAsyncTupleDatabaseClientApi>; }; export type AsyncCallback = (writes: WriteOps, txId: TxId) => void | Promise; //# sourceMappingURL=../../../src/database/async/asyncTypes.d.ts.map