import type { AcquisitionOptions, BackendCapabilities, LockBackend, LockConfig } from "./types.js"; /** * Executes function with distributed lock, retries on contention, auto-releases. * Backends are single-attempt (ADR-009), retry logic here with backoff/jitter. * No telemetry (ADR-007) - use withTelemetry() decorator if needed. * * @param backend - Lock backend (Redis, Firestore, custom) * @param fn - Function to execute while holding lock * @param config - Lock config (key, ttlMs, acquisition retry options) * @returns Result of fn execution * @throws {LockError} AcquisitionTimeout, NetworkTimeout, or Internal * @see common/types.ts for LockConfig * @see docs/specs/interface.md for usage examples */ /** * Creates a curried lock function bound to a specific backend. * Internal utility used by backend-specific createLock() convenience functions. * * @internal * @param backend - Lock backend (Redis, Firestore, Postgres, custom) * @returns A function that accepts fn and config */ export declare function createAutoLock(backend: LockBackend): (fn: () => Promise | T, config: LockConfig & { acquisition?: AcquisitionOptions; }) => Promise; export declare function lock(backend: LockBackend, fn: () => Promise | T, config: LockConfig & { acquisition?: AcquisitionOptions; }): Promise;