/** * Session Takeover — Decentralized Lua CAS * * When a pod dies, surviving pods race to claim orphaned sessions. * The Lua script atomically checks and updates the nodeId (compare-and-swap), * ensuring exactly-once ownership transfer with no leader election. */ import type { TakeoverResult } from './ha.types'; /** * Minimal Redis client interface for Lua script execution. */ export interface TakeoverRedisClient { eval(script: string, numkeys: number, ...args: (string | number)[]): Promise; } /** * Attempt to claim an orphaned session via atomic Lua CAS. * * Multiple pods may call this concurrently for the same session. * Exactly one will succeed (return claimed=true), others get claimed=false. * * @param redis - Redis client supporting eval * @param sessionKey - Full Redis key for the session * @param expectedOldNodeId - The dead pod's nodeId (from StoredSession) * @param newNodeId - This pod's nodeId (getMachineId()) * @returns Whether this pod successfully claimed the session */ export declare function attemptSessionTakeover(redis: TakeoverRedisClient, sessionKey: string, expectedOldNodeId: string, newNodeId: string): Promise; //# sourceMappingURL=session-takeover.d.ts.map