import { DocId, OwnedSeat, PeerId, Store, StoreMark, StoreMeta, StoreRecord, WriteOptions } from "@kyneta/exchange"; import { ClassicLevel } from "classic-level"; //#region src/index.d.ts declare function encodeStoreRecord(record: StoreRecord): Uint8Array; declare function decodeStoreRecord(bytes: Uint8Array): StoreRecord; declare class LevelDBStore implements Store { #private; readonly seat: OwnedSeat; private constructor(); /** * Always `null`: an owned directory has one writer by construction, so it * records none, and `append` and `compact` ignore their `WriteOptions`. */ writerOf(_docId: DocId): Promise; currentMeta(docId: DocId): Promise; append(docId: DocId, record: StoreRecord, _options: WriteOptions): Promise; loadAll(docId: DocId): AsyncIterable; mark(docId: DocId): Promise; compact(docId: DocId, records: StoreRecord[], through: StoreMark | null, _options: WriteOptions): Promise; delete(docId: DocId): Promise; listDocIds(prefix?: string): AsyncIterable; close(): Promise; /** * Open the store, holding the directory's seat. Throws * `StoreFormatVersionError` for a store this build cannot read, and when * another handle holds the directory. * * Accepts a path, or an already-built handle: the test seam for fault * injection. jj:pzuytnvo */ static open(dbPathOrDb: string | ClassicLevel): Promise; } /** * Create a LevelDB storage backend for server-side persistence. * * Async: it opens the database, checks its format (stamping a brand-new * store, accepting a compatible one, or throwing `StoreFormatVersionError`) * and takes its seat, the same on every open. `await` it before passing to * the `Exchange`. A second open of the directory while one holds it throws. * * @param dbPath - Directory path where LevelDB stores its files * * @example * ```typescript * import { createLevelDBStore } from "@kyneta/leveldb-store" * * const exchange = new Exchange({ * store: await createLevelDBStore("./data/exchange-db"), * }) * ``` */ declare function createLevelDBStore(dbPath: string): Promise; //#endregion export { LevelDBStore, createLevelDBStore, decodeStoreRecord, encodeStoreRecord }; //# sourceMappingURL=index.d.ts.map