import type { ObjectWithId } from '@naturalcycles/js-lib/types';
import type { JsonSchema } from '@naturalcycles/nodejs-lib/ajv';
import { Pipeline } from '@naturalcycles/nodejs-lib/stream';
import { BaseCommonDB } from '../../commondb/base.common.db.js';
import type { CommonDB, CommonDBSupport } from '../../commondb/common.db.js';
import type { CommonDBOptions, CommonDBSaveOptions, CommonDBStreamOptions, DBSaveBatchOperation, RunQueryResult } from '../../db.model.js';
import type { DBQuery } from '../../query/dbQuery.js';
import type { FileDBCfg } from './file.db.model.js';
/**
 * Provides barebone implementation for "whole file" based CommonDB.
 * "whole file" means that the persistence layer doesn't allow any querying,
 * but allows to read the whole file or save the whole file.
 * For example, Google Cloud Storage / S3 that store ndjson files will be such persistence.
 *
 * In contrast with InMemoryDB, FileDB stores *nothing* in memory.
 * Each load/query operation loads *whole* file from the persitence layer.
 * Each save operation saves *whole* file to the persistence layer.
 */
export declare class FileDB extends BaseCommonDB implements CommonDB {
    support: CommonDBSupport;
    constructor(cfg: FileDBCfg);
    cfg: FileDBCfg;
    ping(): Promise<void>;
    getTables(): Promise<string[]>;
    getByIds<ROW extends ObjectWithId>(table: string, ids: string[], _opt?: CommonDBOptions): Promise<ROW[]>;
    saveBatch<ROW extends ObjectWithId>(table: string, rows: ROW[], _opt?: CommonDBSaveOptions<ROW>): Promise<void>;
    runQuery<ROW extends ObjectWithId>(q: DBQuery<ROW>, _opt?: CommonDBOptions): Promise<RunQueryResult<ROW>>;
    runQueryCount<ROW extends ObjectWithId>(q: DBQuery<ROW>, _opt?: CommonDBOptions): Promise<number>;
    streamQuery<ROW extends ObjectWithId>(q: DBQuery<ROW>, opt?: CommonDBStreamOptions): Pipeline<ROW>;
    deleteByQuery<ROW extends ObjectWithId>(q: DBQuery<ROW>, _opt?: CommonDBOptions): Promise<number>;
    deleteByIds(table: string, ids: string[], _opt?: CommonDBOptions): Promise<number>;
    getTableSchema<ROW extends ObjectWithId>(table: string): Promise<JsonSchema<ROW>>;
    loadFile<ROW extends ObjectWithId>(table: string): Promise<ROW[]>;
    saveFile<ROW extends ObjectWithId>(table: string, _rows: ROW[]): Promise<void>;
    saveFiles<ROW extends ObjectWithId>(ops: DBSaveBatchOperation<ROW>[]): Promise<void>;
    sortRows<ROW extends ObjectWithId>(rows: ROW[]): ROW[];
    private logStarted;
    private logFinished;
}
