/// <reference types="node" />
import { ChildProcess } from 'child_process';
import { MongoBinaryOpts } from './MongoBinary';
import { StorageEngineT, SpawnOptions, DebugFn, ErrorVoidCallback, EmptyVoidCallback } from '../types';
export interface MongodOps {
    instance: {
        port?: number;
        ip?: string;
        storageEngine?: StorageEngineT;
        dbPath?: string;
        replSet?: string;
        args?: string[];
        auth?: boolean;
    };
    binary?: MongoBinaryOpts;
    spawn?: SpawnOptions;
}
/**
 * MongoDB Instance Handler Class
 */
export default class MongoInstance {
    static childProcessList: ChildProcess[];
    opts: MongodOps;
    debug: DebugFn;
    childProcess: ChildProcess | null;
    killerProcess: ChildProcess | null;
    waitForPrimaryResolveFns: ((value: boolean) => void)[];
    isInstancePrimary: boolean;
    isInstanceReady: boolean;
    instanceReady: EmptyVoidCallback;
    instanceFailed: ErrorVoidCallback;
    constructor(opts: MongodOps);
    /**
     * Create an new instance an call method "run"
     * @param opts Options passed to the new instance
     */
    static run(opts: MongodOps): Promise<MongoInstance>;
    /**
     * Create an array of arguments for the mongod instance
     */
    prepareCommandArgs(): string[];
    /**
     * Create the mongod process
     */
    run(): Promise<this>;
    kill(): Promise<MongoInstance>;
    /**
     * Get the PID of the mongod instance
     */
    getPid(): number | undefined;
    /**
     * Wait until the Primary mongod is running
     */
    waitPrimaryReady(): Promise<boolean>;
    /**
     * Actually launch mongod
     * @param mongoBin The binary to run
     */
    _launchMongod(mongoBin: string): ChildProcess;
    /**
     * Spawn an child to kill the parent and the mongod instance if both are Dead
     * @param parentPid Parent to kill
     * @param childPid Mongod process to kill
     */
    _launchKiller(parentPid: number, childPid: number): ChildProcess;
    errorHandler(err: string): void;
    /**
     * Write the CLOSE event to the debug function
     * @param code The Exit code
     */
    closeHandler(code: number): void;
    /**
     * Write STDERR to debug function
     * @param message The STDERR line to write
     */
    stderrHandler(message: string | Buffer): void;
    /**
     * Write STDOUT to debug function AND instanceReady/instanceFailed if inputs match
     * @param message The STDOUT line to write/parse
     */
    stdoutHandler(message: string | Buffer): void;
}
//# sourceMappingURL=MongoInstance.d.ts.map