/**
 * Copyright 2024 Mytra Control S.L. All rights reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be found in the LICENSE file
 * or at https://opensource.org/licenses/MIT.
 */
import { LoggerInstance } from '@mdf.js/logger';
import { Aggregator } from '../Aggregator';
import { Port } from './Port';
/**
 * The MasterPort class facilitates health monitoring within a master process of a clustered Node.js
 * application.
 * It periodically requests health checks from worker processes and aggregates their responses to
 * maintain an updated view of the application's overall health status.
 *
 * Inherits from the Port class, leveraging shared functionality and adding specific mechanisms for
 * handling health diagnostic requests and responses in a cluster master context.
 */
export declare class MasterPort extends Port {
    private readonly aggregator;
    private readonly interval;
    /** Request sequence number */
    private requestId;
    /** Timeout interval handler for master polling */
    private timeInterval?;
    /**
     * Create an instance of health manager in a master process
     * @param aggregator - Aggregator instance for aggregating health checks from workers.
     * @param logger - Logger instance for logging activities
     * @param interval - interval in milliseconds between each health registry poll from workers.
     */
    constructor(aggregator: Aggregator, logger: LoggerInstance, interval?: number);
    /**
     * Starts the process of periodically polling health registries from worker processes.
     * Ensures that only one polling mechanism is active at any given time.
     */
    start(): void;
    /**
     * Stops the polling of health registries from worker processes and clears the polling interval.
     */
    stop(): void;
    /**
     * Sends a request to all worker processes to send their current health registries.
     * Handles responses, timeouts, and updates the aggregator with aggregated health checks from
     * workers.
     */
    private readonly onSendRequest;
    /**
     * Initializes health checks for all workers, setting up baseline checks for connection status
     * and default health status as 'outdated' until updated by worker responses.
     * @returns Initial checks for all workers.
     */
    private initializeWorkersChecks;
    /**
     * Merge the checks from a worker, including in them the PID and worker identifier, with passed
     * feed passed as argument
     * @param feed - feed where to merge the checks
     * @param worker - Worker that emit the checks
     * @param checks - Checks to be merged
     * @returns The feed with the merged checks
     */
    private mergeChecks;
    /**
     * Retrieves a dictionary of currently active worker processes.
     * @returns A dictionary of Worker instances indexed by their cluster worker ID.
     */
    private get workers();
}
//# sourceMappingURL=MasterPort.d.ts.map