import { MemoryBlockstore } from '@alanshaw/pail/block';
import { BlockFetcher, AnyBlock, AnyLink, BulkResult, ClockHead, DbCarHeader, IdxCarHeader, IdxMeta, IdxMetaCar, BulkResultCar } from './types';
import { DbLoader, IdxLoader } from './loader';
/** forked from
 * https://github.com/alanshaw/pail/blob/main/src/block.js
 * thanks Alan
**/
export declare class Transaction extends MemoryBlockstore {
    private parent;
    constructor(parent: BlockFetcher);
    get(cid: AnyLink): Promise<AnyBlock | undefined>;
    superGet(cid: AnyLink): Promise<AnyBlock | undefined>;
}
declare abstract class FireproofBlockstore implements BlockFetcher {
    ready: Promise<IdxCarHeader | DbCarHeader>;
    name: string | null;
    loader: DbLoader | IdxLoader | null;
    private transactions;
    constructor(name: string | null, loaderFactory: (name: string) => DbLoader | IdxLoader, defaultHeader: () => DbCarHeader | IdxCarHeader);
    abstract commit(_t: Transaction, _done: IdxMeta | BulkResult, _indexes?: Map<string, IdxMeta>): Promise<AnyLink | undefined>;
    abstract transaction(fn: (t: Transaction) => Promise<IdxMeta | BulkResult>, indexes?: Map<string, IdxMeta>): Promise<BulkResultCar | IdxMetaCar>;
    put(): Promise<void>;
    get(cid: AnyLink): Promise<AnyBlock | undefined>;
    commitCompaction(t: Transaction, head: ClockHead): Promise<AnyLink | undefined>;
    addTransaction(t: Transaction): void;
    entries(): AsyncIterableIterator<AnyBlock>;
    protected executeTransaction<T, R>(fn: (t: Transaction) => Promise<T>, commitHandler: (t: Transaction, done: T) => Promise<{
        car?: AnyLink;
        done: R;
    }>): Promise<R>;
}
export declare class IndexBlockstore extends FireproofBlockstore {
    ready: Promise<IdxCarHeader>;
    constructor(name?: string);
    commit(t: Transaction, _done: IdxMeta, indexes: Map<string, IdxMeta>): Promise<AnyLink | undefined>;
    transaction(fn: (t: Transaction) => Promise<IdxMeta>, indexes: Map<string, IdxMeta>): Promise<IdxMetaCar>;
}
export declare class TransactionBlockstore extends FireproofBlockstore {
    ready: Promise<DbCarHeader>;
    constructor(name?: string);
    commit(t: Transaction, done: BulkResult, _indexes?: Map<string, any>): Promise<AnyLink | undefined>;
    transaction(fn: (t: Transaction) => Promise<BulkResult>): Promise<BulkResultCar>;
}
export {};
