/** * Heartbeat Service * * Writes a TTL key to Redis at a regular interval to signal pod liveness. * When a pod dies, its heartbeat key expires and other pods can detect the death. */ import { type HaConfig, type HeartbeatValue } from './ha.types'; /** * Minimal Redis client interface (subset of ioredis). * Allows the service to work with any Redis-compatible client. */ export interface HeartbeatRedisClient { set(key: string, value: string, expiryMode: 'PX', time: number): Promise; get(key: string): Promise; del(key: string): Promise; exists(key: string): Promise; keys(pattern: string): Promise; } export declare class HeartbeatService { private readonly redis; private readonly nodeId; private timer; private readonly startedAt; private readonly keyPrefix; private readonly intervalMs; private readonly ttlMs; private sessionCount; constructor(redis: HeartbeatRedisClient, nodeId: string, config?: Partial); /** Start the heartbeat interval. */ start(): void; /** Stop the heartbeat and remove the key. */ stop(): Promise; /** Update the tracked session count (for monitoring). */ setSessionCount(count: number): void; /** Check if a specific node's heartbeat is alive. */ isAlive(nodeId: string): Promise; /** Get the heartbeat value for a specific node. */ getHeartbeat(nodeId: string): Promise; /** Get all alive node IDs by scanning heartbeat keys. */ getAliveNodes(): Promise; private heartbeatKey; private writeHeartbeat; } //# sourceMappingURL=heartbeat.service.d.ts.map