import type { Nullable } from "../types/index.js"; /** * Data collected from an active stream at shutdown, passed in by the shutdown handler. */ export interface ResumeStreamData { channelName: string; initSegment: Nullable; initVersion: number; segmentIndex: number; trackTimestamps: Map; } /** * Resume data returned to the caller for seeding a new segmenter. */ export interface ResumeData { initSegment: Nullable; initVersion: number; segmentIndex: number; trackTimestamps: Map; } /** * Loads resume state from disk into memory. Called once at startup after config loading. The file is deleted immediately after reading — it only needs to exist * between shutdown and the next startup. If the file is missing or corrupt, the map stays empty and all streams start at 0 (today's behavior). */ export declare function loadResumeState(): void; /** * Consumes resume data for a channel. Returns the seeding parameters if the entry exists and is within TTL, or null if no resume data is available. The entry is * removed from the in-memory map after consumption (each channel resumes at most once). * @param channelName - The channel key to look up. * @returns Resume data for seeding the segmenter, or null. */ export declare function consumeResumeData(channelName: string): Nullable; /** * Saves resume state to disk. Merges active stream data (always takes precedence for a given channel) with unconsumed in-memory entries still within TTL. This * supports the rapid-restart scenario where a channel that never reconnected carries forward through multiple restart cycles. * * Called during graceful shutdown with data collected from active streams by the shutdown handler. The caller passes pre-collected stream data to avoid circular * dependencies with the registry module. * @param entries - Stream data collected from active streams at shutdown. */ export declare function saveResumeState(entries: ResumeStreamData[]): void;