/** * Background lease renewer. * * Any code that holds a blob lease for longer than the lease TTL (60 s * max on Azure) MUST renew it periodically — Azure does not auto-renew. * Without a renewer, a long-running workload silently crosses the 60 s * ceiling and the next `AppendBlock` fails with `LeaseLost`. * * The producer holds the lease on `current-N.jsonl` for its entire lifetime; * the consumer holds the lease on `.consumer_groups/.offset` for the * same. Both call this exact helper. We renew at TTL/3 so a single missed * renewal still leaves ~TTL × 2/3 of budget. * * Error policy: the renewer logs renewal errors to stderr (via OTEL when * available — see below) and keeps trying. We deliberately do NOT propagate * the error inline because: * 1. The next mutating op against the leased blob will fail with * `LeaseLostError` and the caller's primary code path will handle it * authoritatively. * 2. Renewal can transiently fail (network blip) and recover on the next tick * while we still hold the lease. Aborting on the first failed renew would * be a false positive. * * Returns an async stop function. Callers MUST `await stop()` in a `finally` * block (and also release the lease — see ADR-0004). */ import { type LeaseToken, type StorageProvider } from '../storage/types.js'; export type LeaseRenewerOptions = { /** * Override the renewal interval. Defaults to `lease.ttlSeconds * 1000 / 3` * (floor 1 000 ms). Only override for tests that want to force aggressive * renewal cadence. */ readonly intervalMs?: number; readonly onRenewed?: () => void; /** Called when a renewal fails with {@link LeaseLostError}: the lease is no longer this holder's. */ readonly onLost?: () => void; }; export type LeaseRenewerHandle = { /** Stop the renewer. Idempotent. Always `await` this in a `finally` block. */ stop(): Promise; }; export declare function startLeaseRenewer(provider: Pick, path: string, lease: LeaseToken, options?: LeaseRenewerOptions): LeaseRenewerHandle; //# sourceMappingURL=leaseRenewer.d.ts.map