import { type Kysely } from 'kysely';
import type { Database } from '../db/types.js';
import type { EventStore } from './event-store.js';
import type { EventRouterConfig } from './types.js';
interface EventRetryScannerOptions {
    db: Kysely<Database>;
    eventStore: EventStore;
    config: EventRouterConfig;
}
/**
 * Leader-only periodic scanner that closes two gaps in event delivery:
 *
 *  1. Retries: events whose `next_retry_at <= NOW()` are re-published via
 *     `pg_notify('kici_event_channel', id)` so any healthy orchestrator
 *     picks them up via the normal `LISTEN/NOTIFY` path. The receiver's
 *     `tryLeaseForProcessing` ensures only one node actually dispatches.
 *
 *  2. Lease expiry: events whose `claimed_at` is older than
 *     `leaseDurationMs` belong to a node that crashed (or hung) before
 *     finalising the dispatch. The scanner releases the lease (clears
 *     `claimed_at`, sets `next_retry_at = NOW()`) and re-publishes
 *     `pg_notify`. This is the visible signal — via
 *     `kici_orch_event_lease_expirations_total` — that a node died
 *     mid-dispatch.
 *
 * The scanner also refreshes the `kici_orch_event_dlq_depth` gauge so
 * operators can alert on DLQ growth.
 *
 * Modeled on `CronScheduler`: leader-only, started/stopped via Raft
 * leadership callbacks, single timer cleared on `stop()`.
 */
export declare class EventRetryScanner {
    private readonly db;
    private readonly eventStore;
    private readonly config;
    private timer;
    private isLeader;
    constructor(options: EventRetryScannerOptions);
    onBecomeLeader(): void;
    onLoseLeadership(): void;
    stop(): void;
    /**
     * One scanner tick. Public for tests; not on the hot path otherwise.
     */
    tick(): Promise<void>;
    private processExpiredLeases;
    private processDueRetries;
    private refreshDlqDepth;
    private publishNotify;
}
export {};
//# sourceMappingURL=event-retry-scanner.d.ts.map