import { LangName, StrictSchema } from '@based/schema';
import { createTree } from './csmt/index.js';
import { StartOpts } from './start.js';
import { CsmtNodeRange } from './tree.js';
import { TransformFns } from './migrate/index.js';
import exitHook from 'exit-hook';
import { SchemaChecksum } from '../schema.js';
import { DbWorker } from './DbWorker.js';
import { DbShared } from '../shared/DbBase.js';
declare class SortIndex {
    constructor(buf: Uint8Array, dbCtxExternal: any);
    buf: Uint8Array;
    idx: any;
    cnt: number;
}
export declare class DbServer extends DbShared {
    #private;
    modifyDirtyRanges: Float64Array;
    dbCtxExternal: any;
    migrating: number;
    saveInProgress: boolean;
    fileSystemPath: string;
    merkleTree: ReturnType<typeof createTree<CsmtNodeRange>>;
    dirtyRanges: Set<number>;
    csmtHashFun: {
        update: (buf: Uint8Array) => any;
        digest: (encoding?: "hex") => Uint8Array | string;
        reset: () => void;
    };
    workers: DbWorker[];
    availableWorkerIndex: number;
    processingQueries: number;
    modifyQueue: Uint8Array[];
    queryQueue: Map<Function, Uint8Array>;
    stopped: boolean;
    unlistenExit: ReturnType<typeof exitHook>;
    saveIntervalInSeconds?: number;
    saveInterval?: NodeJS.Timeout;
    delayInMs?: number;
    constructor({ path, debug, saveIntervalInSeconds, }: {
        path: string;
        debug?: boolean;
        saveIntervalInSeconds?: number;
    });
    start(opts?: StartOpts): Promise<void>;
    save(opts?: {
        forceFullDump?: boolean;
    }): Promise<void>;
    createCsmtHashFun: () => {
        update: (buf: Uint8Array) => any;
        digest: (encoding?: "hex") => Uint8Array | string;
        reset: () => void;
    };
    sortIndexes: {
        [type: number]: {
            [field: number]: {
                [start: number]: {
                    [lang: number]: SortIndex;
                };
            };
        };
    };
    cleanupTimer: NodeJS.Timeout;
    cleanup(): void;
    createSortIndex(type: string, field: string, lang?: LangName): SortIndex;
    destroySortIndex(type: string, field: string, lang?: LangName): any;
    getSortIndex(typeId: number, field: number, start: number, lang: number): SortIndex;
    createSortIndexBuffer(typeId: number, field: number, start: number, lang: number): SortIndex;
    setSchema(strictSchema: StrictSchema, transformFns?: TransformFns): Promise<SchemaChecksum>;
    modify(bufWithHash: Uint8Array): Record<number, number> | null;
    addToQueryQueue(resolve: any, buf: any): Promise<Uint8Array>;
    getQueryBuf(buf: Uint8Array, fromQueue?: boolean): Promise<Uint8Array>;
    onQueryEnd(): any;
    stop(noSave?: boolean): Promise<void>;
    destroy(): Promise<void>;
}
export {};
