/**
 * Hot-reload infrastructure for orchestrator configuration.
 *
 * ConfigReloader handles SIGHUP, HTTP endpoint, and programmatic reload triggers
 * with debounce, mutex serialization, validation-before-swap, drain mode,
 * and Prometheus metrics.
 *
 * Safety guarantees:
 * - Concurrent reloads serialized via mutex (no partial state)
 * - Validation before swap (old config preserved on failure)
 * - Restart-required fields detected but not applied (database.url, server.port)
 * - Drain mode for zero-disruption reload
 */
import type { Logger } from '@kici-dev/shared';
import type { AppConfig, SharedConfig } from './types.js';
import type { SharedConfigStore } from './shared-store.js';
/**
 * Source of a reload trigger.
 */
export type ReloadSource = 'sighup' | 'http' | 'cluster' | 'cli';
/**
 * Result of a reload operation.
 */
export interface ReloadResult {
    success: boolean;
    version?: number;
    errors?: string[];
    /** Fields that changed but need restart to apply */
    restartRequired?: string[];
    /** Fields that were hot-reloaded */
    fieldsChanged?: string[];
}
/**
 * Options for executeReload.
 */
export interface ReloadOptions {
    /** Whether to drain in-flight work before reloading */
    drain?: boolean;
    /** Reload trigger source for metrics */
    source: ReloadSource;
}
/**
 * Dependencies injected into ConfigReloader.
 */
export interface ConfigReloaderDeps {
    /** Load local config from YAML + env */
    resolveLocalConfig: () => Promise<{
        local: Record<string, unknown>;
    }>;
    /** Merge all layers into AppConfig */
    resolveFullConfig: (local: Record<string, unknown>, dbConfig: SharedConfig | null) => AppConfig;
    /** Shared config store (null if no DB config) */
    sharedStore: SharedConfigStore | null;
    /** Called after successful reload when provider config changed */
    onProviderChange?: (newConfig: AppConfig, oldConfig: AppConfig) => Promise<void>;
    /** Called to reload scaler configuration */
    onScalerReload?: () => Promise<void>;
    /** Called when Platform connection settings changed */
    onPlatformReconnect?: (newConfig: AppConfig) => Promise<void>;
    /** Atomic swap callback -- replaces the config reference */
    onConfigApplied?: (newConfig: AppConfig) => void;
    /** Start draining in-flight work */
    startDrain?: () => Promise<void>;
    /** Stop drain and resume accepting work */
    stopDrain?: () => void;
    logger: Logger;
}
/**
 * ConfigReloader manages hot-reload of orchestrator configuration.
 *
 * Handles SIGHUP signals, HTTP-triggered reloads, and cluster-triggered reloads
 * with debounce, mutex, validation-before-swap, and Prometheus metrics.
 */
export declare class ConfigReloader {
    private currentConfig;
    private reloading;
    private debounceTimer;
    private currentVersion;
    private readonly deps;
    /** Debounce interval in milliseconds */
    static DEBOUNCE_MS: number;
    constructor(initialConfig: AppConfig, deps: ConfigReloaderDeps);
    /**
     * Trigger a reload (debounced).
     * Multiple rapid triggers will be collapsed into a single reload.
     */
    triggerReload(source: ReloadSource, opts?: {
        drain?: boolean;
    }): void;
    /**
     * Execute reload immediately (no debounce).
     * Used by tests and direct API calls that need synchronous results.
     */
    executeReload(opts: ReloadOptions): Promise<ReloadResult>;
    /**
     * Get the current effective config.
     */
    getCurrentConfig(): AppConfig;
    /**
     * Get the current shared config version.
     */
    getCurrentVersion(): number;
    /**
     * Install SIGHUP handler for signal-triggered reload.
     * SIGHUP triggers unified reload of both orchestrator config AND scaler config.
     */
    installSignalHandler(): void;
    /**
     * Clean up timers and resources.
     */
    dispose(): void;
}
//# sourceMappingURL=reload.d.ts.map