import { JsonSchemaObject, JsonSchemaRootObject, ObjectWithId } from '@naturalcycles/js-lib';
import { ReadableTyped } from '@naturalcycles/nodejs-lib';
import { BaseCommonDB } from '../../base.common.db';
import { CommonDB, CommonDBSupport } from '../../common.db';
import { RunQueryResult } from '../../db.model';
import { DBQuery } from '../../query/dbQuery';
import { CacheDBCfg, CacheDBCreateOptions, CacheDBOptions, CacheDBSaveOptions, CacheDBStreamOptions } from './cache.db.model';
/**
 * CommonDB implementation that proxies requests to downstream CommonDB
 * and does in-memory caching.
 *
 * Queries always hit downstream (unless `onlyCache` is passed)
 */
export declare class CacheDB extends BaseCommonDB implements CommonDB {
    support: CommonDBSupport;
    constructor(cfg: CacheDBCfg);
    cfg: CacheDBCfg;
    ping(): Promise<void>;
    /**
     * Resets InMemory DB data
     */
    getTables(): Promise<string[]>;
    getTableSchema<ROW extends ObjectWithId>(table: string): Promise<JsonSchemaRootObject<ROW>>;
    createTable<ROW extends ObjectWithId>(table: string, schema: JsonSchemaObject<ROW>, opt?: CacheDBCreateOptions): Promise<void>;
    getByIds<ROW extends ObjectWithId>(table: string, ids: string[], opt?: CacheDBSaveOptions<ROW>): Promise<ROW[]>;
    saveBatch<ROW extends ObjectWithId>(table: string, rows: ROW[], opt?: CacheDBSaveOptions<ROW>): Promise<void>;
    runQuery<ROW extends ObjectWithId>(q: DBQuery<ROW>, opt?: CacheDBSaveOptions<ROW>): Promise<RunQueryResult<ROW>>;
    runQueryCount<ROW extends ObjectWithId>(q: DBQuery<ROW>, opt?: CacheDBOptions): Promise<number>;
    streamQuery<ROW extends ObjectWithId>(q: DBQuery<ROW>, opt?: CacheDBStreamOptions): ReadableTyped<ROW>;
    deleteByQuery<ROW extends ObjectWithId>(q: DBQuery<ROW>, opt?: CacheDBOptions): Promise<number>;
    patchByQuery<ROW extends ObjectWithId>(q: DBQuery<ROW>, patch: Partial<ROW>, opt?: CacheDBOptions): Promise<number>;
}
