import { Type } from "@chainsafe/ssz"; import { ChainForkConfig } from "@lodestar/config"; import { FilterOptions, KeyValue } from "./controller/index.js"; import { Db, DbBatch, DbReqOpts } from "./controller/interface.js"; export type Id = Uint8Array | string | number | bigint; /** * BinaryRepository is a high level kv storage * managing a Uint8Array to Uint8Array kv database * It translates typed keys and Uint8Array values required by the underlying database */ export declare abstract class BinaryRepository { protected config: ChainForkConfig; protected db: Db; protected bucket: number; protected readonly bucketId: string; protected readonly dbReqOpts: DbReqOpts; protected readonly minKey: Uint8Array; protected readonly maxKey: Uint8Array; protected constructor(config: ChainForkConfig, db: Db, bucket: number, bucketId: string); keys(opts?: FilterOptions): Promise; keysStream(opts?: FilterOptions): AsyncIterable; firstKey(): Promise; lastKey(): Promise; encodeKey(id: I): Uint8Array; decodeKey(key: Uint8Array): I; getBinary(id: I): Promise; putBinary(id: I, value: Uint8Array): Promise; binaries(opts?: FilterOptions): Promise; lastBinary(): Promise; batchPutBinary(items: KeyValue[]): Promise; binaryEntriesStream(opts?: FilterOptions): AsyncIterable>; has(id: I): Promise; delete(id: I): Promise; batchDelete(ids: I[]): Promise; batchBinary(batch: DbBatch): Promise; /** * Transforms opts from I to Uint8Array */ protected dbFilterOptions(opts?: FilterOptions): FilterOptions; } /** * Repository is a high level kv storage * managing a Uint8Array to Uint8Array kv database * It translates typed keys and values to Uint8Arrays required by the underlying database * * By default, SSZ-encoded values, * indexed by root */ export declare abstract class Repository extends BinaryRepository { protected type: Type; protected constructor(config: ChainForkConfig, db: Db, bucket: number, type: Type, bucketId: string); encodeValue(value: T): Uint8Array; decodeValue(data: Uint8Array): T; get(id: I): Promise; put(id: I, value: T): Promise; getId(value: T): I; add(value: T): Promise; remove(value: T): Promise; batchPut(items: KeyValue[]): Promise; batch(batch: DbBatch): Promise; batchAdd(values: T[]): Promise; batchRemove(values: T[]): Promise; values(opts?: FilterOptions): Promise; valuesStream(opts?: FilterOptions): AsyncIterable; entries(opts?: FilterOptions): Promise[]>; entriesStream(opts?: FilterOptions): AsyncIterable>; firstValue(): Promise; lastValue(): Promise; firstEntry(): Promise | null>; lastEntry(): Promise | null>; } //# sourceMappingURL=abstractRepository.d.ts.map