export default class VelociousHttpServer {
    /**
     * Runs constructor.
     * @param {object} args - Options object.
     * @param {import("../configuration.js").default} args.configuration - Configuration instance.
     * @param {string} [args.host] - Host.
     * @param {boolean} [args.inProcess] - Run HTTP handlers in the main thread instead of worker threads.
     * @param {number} [args.port] - Port.
     * @param {number} [args.maxWorkers] - Max workers.
     * @param {number} [args.workers] - Worker handlers to start.
     * @param {function({configuration: import("../configuration.js").default, onReload: function({changedPath: string}) : Promise<void>}) : {start: () => Promise<void>, stop: () => Promise<void>}} [args.developmentReloaderFactory] - Development reloader factory.
     * @param {WorkerHandlerFactory} [args.workerHandlerFactory] - Worker handler factory.
     */
    constructor({ configuration, developmentReloaderFactory, host, inProcess, maxWorkers, port, workerHandlerFactory, workers }: {
        configuration: import("../configuration.js").default;
        host?: string | undefined;
        inProcess?: boolean | undefined;
        port?: number | undefined;
        maxWorkers?: number | undefined;
        workers?: number | undefined;
        developmentReloaderFactory?: ((arg0: {
            configuration: import("../configuration.js").default;
            onReload: (arg0: {
                changedPath: string;
            }) => Promise<void>;
        }) => {
            start: () => Promise<void>;
            stop: () => Promise<void>;
        }) | undefined;
        workerHandlerFactory?: WorkerHandlerFactory | undefined;
    });
    clientCount: number;
    _starting: boolean;
    /**
     * Narrows the runtime value to the documented type.
      @type {DevelopmentReloader | DevelopmentReloaderLike | undefined} */
    developmentReloader: DevelopmentReloader | DevelopmentReloaderLike | undefined;
    /**
     * Narrows the runtime value to the documented type.
      @type {import("net").Server | undefined} */
    netServer: import("net").Server | undefined;
    /**
     * Narrows the runtime value to the documented type.
      @type {WorkerHandlerFactory | undefined} */
    workerHandlerFactory: WorkerHandlerFactory | undefined;
    /**
     * Clients.
      @type {Record<string, ServerClient>}  */
    clients: Record<string, ServerClient>;
    /**
     * Active sockets.
      @type {Set<import("net").Socket>} */
    _activeSockets: Set<import("net").Socket>;
    events: import("eventemitter3").EventEmitter<string | symbol, any>;
    workerCount: number;
    /**
     * Worker handlers.
      @type {Array<WorkerHandler | InProcessHandler>} */
    workerHandlers: Array<WorkerHandler | InProcessHandler>;
    nextWorkerHandlerIndex: number;
    /**
     * Sticky worker handlers.
      @type {Map<string, WorkerHandler | InProcessHandler>} */
    stickyWorkerHandlers: Map<string, WorkerHandler | InProcessHandler>;
    configuration: import("../configuration.js").default;
    developmentReloaderFactory: ((arg0: {
        configuration: import("../configuration.js").default;
        onReload: (arg0: {
            changedPath: string;
        }) => Promise<void>;
    }) => {
        start: () => Promise<void>;
        stop: () => Promise<void>;
    }) | undefined;
    inProcess: boolean;
    logger: Logger;
    host: string;
    port: number;
    workers: number;
    /**
     * Runs start.
     * @returns {Promise<void>} - Resolves when complete.
     */
    start(): Promise<void>;
    /**
     * Runs capture startup state.
     * @returns {{developmentReloader: DevelopmentReloader | DevelopmentReloaderLike | undefined, netServer: import("net").Server | undefined, workerHandlers: Array<WorkerHandler | InProcessHandler>}} - Startup state.
     */
    _captureStartupState(): {
        developmentReloader: DevelopmentReloader | DevelopmentReloaderLike | undefined;
        netServer: import("net").Server | undefined;
        workerHandlers: Array<WorkerHandler | InProcessHandler>;
    };
    /**
     * Runs stop startup resources.
     * @param {ReturnType<VelociousHttpServer["_captureStartupState"]>} startupState - State captured before startup.
     * @returns {Promise<void>} - Resolves when cleanup is complete.
     */
    _stopStartupResources(startupState: ReturnType<VelociousHttpServer["_captureStartupState"]>): Promise<void>;
    /**
     * Runs net server listen.
     * @returns {Promise<void>} - Resolves when complete.
     */
    _netServerListen(): Promise<void>;
    /**
     * Runs ensure workers.
     * @returns {Promise<void>} - Resolves when complete.
     */
    _ensureWorkers(): Promise<void>;
    /**
     * Runs is active.
     * @returns {boolean} - Whether active.
     */
    isActive(): boolean;
    /**
     * Runs get debug snapshot.
     * @returns {Promise<Record<string, ?>>} - HTTP server worker diagnostics.
     */
    getDebugSnapshot(): Promise<Record<string, unknown>>;
    /**
     * Runs worker debug snapshot.
     * @param {WorkerHandler | InProcessHandler} workerHandler - Worker handler to inspect.
     * @returns {Promise<Record<string, ?>>} Worker debug snapshot.
     */
    workerDebugSnapshot(workerHandler: WorkerHandler | InProcessHandler): Promise<Record<string, unknown>>;
    /**
     * Runs in process worker debug snapshot.
     * @param {InProcessHandler} workerHandler - In-process worker handler to inspect.
     * @returns {Record<string, ?>} Worker debug snapshot.
     */
    inProcessWorkerDebugSnapshot(workerHandler: InProcessHandler): Record<string, unknown>;
    /**
     * Runs stop clients.
     * @returns {Promise<void>} - Resolves when complete.
     */
    stopClients(): Promise<void>;
    /**
     * Runs stop server.
     * @param {import("net").Server | undefined} [netServer] - Server to stop.
     * @returns {Promise<void>} - Resolves when complete.
     */
    stopServer(netServer?: import("net").Server | undefined): Promise<void>;
    /**
     * Runs stop.
     * @returns {Promise<void>} - Resolves when complete.
     */
    stop(): Promise<void>;
    _stopping: boolean | undefined;
    /**
     * On close.
     * @returns {void} - No return value.
     */
    onClose: () => void;
    /**
     * On server error.
     * @param {Error} error - Server socket error.
     * @returns {void} - No return value.
     */
    onServerError: (error: Error) => void;
    /**
     * On connection.
     * @param {import("net").Socket} socket - Socket instance.
     * @returns {void} - No return value.
     */
    onConnection: (socket: import("net").Socket) => void;
    /**
     * On client close.
     * @param {ServerClient} client - Client instance.
     * @returns {void} - No return value.
     */
    onClientClose: (client: ServerClient) => void;
    /**
     * Runs spawn worker.
     * @returns {Promise<void>} - Resolves when complete.
     */
    spawnWorker(): Promise<void>;
    /**
     * Runs build worker handlers.
     * @returns {Promise<Array<WorkerHandler | InProcessHandler>>} - Started worker handlers.
     */
    _buildWorkerHandlers(): Promise<Array<WorkerHandler | InProcessHandler>>;
    /**
     * Runs build worker handler.
     * @returns {Promise<WorkerHandler | InProcessHandler>} - Started worker handler.
     */
    _buildWorkerHandler(): Promise<WorkerHandler | InProcessHandler>;
    /**
     * Runs worker handler to use.
     * @param {object} [args] - Options object.
     * @param {string} [args.stickyKey] - Stable key that must keep routing to the same worker.
     * @returns {WorkerHandler | InProcessHandler} - The worker handler to use.
     */
    workerHandlerToUse({ stickyKey }?: {
        stickyKey?: string | undefined;
    }): WorkerHandler | InProcessHandler;
    /**
     * Runs next round robin worker handler.
     * @returns {WorkerHandler | InProcessHandler} - The next round-robin worker handler.
     */
    _nextRoundRobinWorkerHandler(): WorkerHandler | InProcessHandler;
    /**
     * Runs should use development hot reload.
     * @returns {boolean} - Whether development worker hot reload should run.
     */
    shouldUseDevelopmentHotReload(): boolean;
    /**
     * Runs start development reloader.
     * @returns {Promise<void>} - Resolves when watcher setup finishes.
     */
    _startDevelopmentReloader(): Promise<void>;
    /**
     * Runs reload workers for development.
     * @returns {Promise<void>} - Resolves when workers have been refreshed.
     */
    reloadWorkersForDevelopment(): Promise<void>;
    _reloadWorkersForDevelopmentQueued: boolean | undefined;
    _reloadingWorkersForDevelopment: boolean | undefined;
}
/**
 * Defines this typedef.
 */
export type DevelopmentReloaderLike = {
    start: () => Promise<void>;
    stop: () => Promise<void>;
};
/**
 * Defines this typedef.
 */
export type WorkerHandlerFactory = (arg0: {
    configuration: import("../configuration.js").default;
    workerCount: number;
}) => (WorkerHandler | InProcessHandler);
import DevelopmentReloader from "./development-reloader.js";
import ServerClient from "./server-client.js";
import WorkerHandler from "./worker-handler/index.js";
import InProcessHandler from "./worker-handler/in-process.js";
import Logger from "../logger.js";
//# sourceMappingURL=index.d.ts.map