import type { AcquireOk, AcquireResult, BackendCapabilities, Fence, LockBackend, LockInfo, LockInfoDebug } from "./types.js"; /** * Type guard for fence token presence. Only needed for generic backend code. * * @param result - Acquire result to check * @returns true if successful with fence token */ export declare function hasFence(result: AcquireResult): result is AcquireOk & { fence: Fence; }; /** * Sanitizes raw lock data for safe observability (hashes sensitive fields). * @internal Used by backend implementations */ export declare function sanitizeLockInfo(rawData: { key: string; lockId: string; expiresAtMs: number; acquiredAtMs: number; fence?: string; }, capabilities: C): LockInfo; /** * Attaches raw data for debug access via getByKeyRaw()/getByIdRaw(). * @internal Used by backend implementations */ export declare function attachRawData(lockInfo: LockInfo, rawData: { key: string; lockId: string; }): LockInfo; /** * Looks up lock by key (direct access, O(1)). * @returns Sanitized LockInfo or null */ export declare function getByKey(backend: LockBackend, key: string, opts?: { signal?: AbortSignal; }): Promise | null>; /** * Looks up lock by lockId (reverse lookup). * @returns Sanitized LockInfo or null */ export declare function getById(backend: LockBackend, lockId: string, opts?: { signal?: AbortSignal; }): Promise | null>; /** * Looks up lock by key with raw key/lockId (for debugging). * @returns LockInfoDebug with sensitive fields or null */ export declare function getByKeyRaw(backend: LockBackend, key: string, opts?: { signal?: AbortSignal; }): Promise | null>; /** * Looks up lock by lockId with raw key/lockId (for debugging). * @returns LockInfoDebug with sensitive fields or null */ export declare function getByIdRaw(backend: LockBackend, lockId: string, opts?: { signal?: AbortSignal; }): Promise | null>; /** * Checks if lockId owns an active lock. * * ⚠️ WARNING: This is for DIAGNOSTIC/UI purposes only, NOT a correctness guard! * Never use `owns() → mutate` patterns. Correctness relies on atomic release/extend * with explicit ownership verification (ADR-003). * * @returns true if lockId has an active lock */ export declare function owns(backend: LockBackend, lockId: string): Promise; /** * Logs a warning when fence counter approaches overflow limit. * MANDATORY for all backends when fence > FENCE_THRESHOLDS.WARN (ADR-004). * * @param fence - Current fence value (string or number) * @param key - Lock key for context * @internal Used by backend implementations */ export declare function logFenceWarning(fence: Fence | number, key: string): void; /** * Checks if an AbortSignal has been aborted and throws LockError if so. * Use this to provide cancellation points in long-running operations. * * @param signal - Optional AbortSignal to check * @throws LockError with code "Aborted" if signal is aborted * @internal Used by backend implementations */ export declare function checkAborted(signal?: AbortSignal): void; /** Creates a delay promise for testing/retries. */ export declare function delay(ms: number): Promise;