/** * 2011 Peter 'Pita' Martischka * 2020 John McLear * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS-IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { Database as DatabaseCache, type Metrics } from "./lib/CacheAndBufferLayer"; import { normalizeLogger } from "./lib/logging"; import type { Settings } from "./lib/AbstractDatabase"; export type { Settings } from "./lib/AbstractDatabase"; export type { Metrics, CacheSettings } from "./lib/CacheAndBufferLayer"; export type { Logger } from "./lib/logging"; export type DatabaseType = "cassandra" | "couch" | "dirty" | "dirtygit" | "elasticsearch" | "memory" | "mock" | "mongodb" | "mssql" | "mysql" | "postgres" | "postgrespool" | "redis" | "rethink" | "rustydb" | "sqlite" | "surrealdb"; export declare class Database { readonly type: DatabaseType; readonly dbSettings: Settings | null | string; readonly wrapperSettings: Record | null; private readonly _logger; db: DatabaseCache; metrics: Metrics; /** * @param type The type of the database * @param dbSettings The settings for that specific database type * @param wrapperSettings Cache/buffer layer settings (cache size, write interval, etc.) * @param logger Optional logger (log4js, console, or any object with debug/info/warn/error methods) */ constructor(type: DatabaseType | undefined, dbSettings: Settings | null | string, wrapperSettings?: Record | null, logger?: Partial> | null); init(): Promise; private initDB; flush(): Promise; /** @deprecated Use flush() */ doShutdown(): Promise; get(key: string): Promise; findKeys(key: string, notKey?: string): Promise; /** * Returns up to `options.limit` keys matching `key` (excluding `notKey`), * sorted ascending. Page by passing the last returned key as `options.after` * on the next call; the final page returns fewer than `options.limit` keys. * Designed for memory-bounded iteration over large keyspaces. */ findKeysPaged(key: string, notKey: string | null | undefined, options: { limit: number; after?: string; }): Promise; remove(key: string): Promise; set(key: string, value: unknown): Promise; getSub(key: string, sub: string[]): Promise; setSub(key: string, sub: string[], value: unknown): Promise; close(): Promise; } export default Database; //# sourceMappingURL=index.d.ts.map