import type { Emitter } from '@adonisjs/core/events';
import { QueryClient } from '../query_client/index.js';
import { type ConnectionContract } from '../types/database.js';
/**
 * A database session that the migration runner takes from the pool of
 * a connection, and keeps for the whole run.
 *
 * Advisory locks belong to a database session. The runner takes the lock,
 * runs each migration, and releases the lock on this session. Therefore,
 * when the session ends, the database releases the lock and the active
 * migration fails with it.
 */
export declare class LockSession {
    #private;
    private connection;
    private rawConnection;
    /**
     * Takes a connection from the pool of the given connection and pins
     * a query client to it
     */
    static open(connection: ConnectionContract, emitter: Emitter<any>): Promise<LockSession>;
    /**
     * The query client that runs each query on the pinned connection. It is
     * in "write" mode, so that its reads never use a read replica.
     */
    readonly client: QueryClient;
    private constructor();
    /**
     * Returns true when the database session of the pinned connection
     * has ended
     */
    isLost(): boolean;
    /**
     * Gives the connection back to the pool. The pool validates a connection
     * before it gives it to a query, and destroys a connection whose session
     * has ended.
     */
    release(): void;
}
