import { ClassicLevel } from "classic-level"; import { Logger } from "@lodestar/utils"; import { DatabaseController, DatabaseOptions, DbBatch, DbReqOpts, FilterOptions, KeyValue } from "./interface.js"; import { LevelDbControllerMetrics } from "./metrics.js"; export interface LevelDBOptions extends DatabaseOptions { db?: ClassicLevel; } export type LevelDbControllerModules = { logger: Logger; metrics?: LevelDbControllerMetrics | null; }; /** * The LevelDB implementation of DB */ export declare class LevelDbController implements DatabaseController { private readonly logger; private readonly db; private metrics; private status; private dbSizeMetricInterval?; constructor(logger: Logger, db: ClassicLevel, metrics: LevelDbControllerMetrics | null); static create(opts: LevelDBOptions, { metrics, logger }: LevelDbControllerModules): Promise; close(): Promise; /** To inject metrics after CLI initialization */ setMetrics(metrics: LevelDbControllerMetrics): void; clear(): Promise; get(key: Uint8Array, opts?: DbReqOpts): Promise; /** * Return the multiple items in the order of the given keys * Will return `null` for the keys which does not exists * * https://github.com/Level/abstract-level?tab=readme-ov-file#dbgetmanykeys-options */ getMany(keys: Uint8Array[], opts?: DbReqOpts): Promise<(Uint8Array | undefined)[]>; put(key: Uint8Array, value: Uint8Array, opts?: DbReqOpts): Promise; delete(key: Uint8Array, opts?: DbReqOpts): Promise; batchPut(items: KeyValue[], opts?: DbReqOpts): Promise; batchDelete(keys: Uint8Array[], opts?: DbReqOpts): Promise; batch(batch: DbBatch, opts?: DbReqOpts): Promise; keysStream(opts?: FilterOptions): AsyncIterable; valuesStream(opts?: FilterOptions): AsyncIterable; entriesStream(opts?: FilterOptions): AsyncIterable>; keys(opts?: FilterOptions): Promise; values(opts?: FilterOptions): Promise; entries(opts?: FilterOptions): Promise[]>; /** * Get the approximate number of bytes of file system space used by the range [start..end). * The result might not include recently written data. */ approximateSize(start: Uint8Array, end: Uint8Array): Promise; /** * Manually trigger a database compaction in the range [start..end]. */ compactRange(start: Uint8Array, end: Uint8Array): Promise; /** Capture metrics for db.iterator, db.keys, db.values .all() calls */ private metricsAll; /** Capture metrics for db.iterator, db.keys, db.values AsyncIterable calls */ private metricsIterator; /** Start interval to capture metric for db size */ private collectDbSizeMetric; /** Capture metric for db size */ private dbSizeMetric; static destroy(location: string): Promise; } //# sourceMappingURL=level.d.ts.map