import { Lock, LockManager, LockOptions } from '../interfaces/lock'; /** * Options for memory lock manager */ export interface MemoryLockOptions { /** * Default lock TTL in milliseconds */ defaultTtl?: number; /** * Default retry delay in milliseconds */ defaultRetryDelay?: number; /** * Default maximum number of retry attempts */ defaultMaxRetries?: number; /** * Whether to enable logging */ enableLogging?: boolean; /** * Log level */ logLevel?: 'debug' | 'info' | 'warn' | 'error'; } /** * Memory-based lock manager * Useful for single-process applications or testing */ export declare class MemoryLockManager implements LockManager { private locks; private options; private logger; private autoExtenders; private expirationTimers; /** * Creates a new MemoryLockManager * @param options Lock manager options */ constructor(options?: MemoryLockOptions); /** * Acquire a lock on a resource * @param resource Resource to lock * @param ttl Time-to-live for the lock in milliseconds * @param options Additional lock options * @returns Promise resolving to the acquired lock or null if not acquired */ acquire(resource: string, ttl?: number, options?: LockOptions): Promise; /** * Release a previously acquired lock * @param lock The lock to release * @returns Promise resolving to true if the lock was released */ release(lock: Lock): Promise; /** * Extend the TTL of an existing lock * @param lock The lock to extend * @param ttl Additional time in milliseconds to add to the lock TTL * @returns Promise resolving to the updated lock or null if extension failed */ extend(lock: Lock, ttl: number): Promise; /** * Check if a lock exists on a resource * @param resource Resource to check * @returns Promise resolving to the existing lock or null if not locked */ check(resource: string): Promise; /** * Get all locks * @returns Promise resolving to a map of resource-to-lock mappings */ getAll(): Promise>; /** * Clear all locks (for administrative purposes) * @returns Promise resolving to true if successful */ clear(): Promise; /** * Execute a function within a lock * @param resource Resource to lock * @param fn Function to execute with the lock * @param ttl Time-to-live for the lock in milliseconds * @param options Additional lock options * @returns Promise resolving to the function result */ withLock(resource: string, fn: (lock: Lock) => Promise, ttl?: number, options?: LockOptions): Promise; /** * Check if a resource is currently locked * @param resource Resource to check * @returns True if the resource is locked */ private isLocked; /** * Set up expiration timer for a lock * @param lock Lock to expire */ private setupExpirationTimer; /** * Clear expiration timer for a lock * @param lock Lock to clear timer for */ private clearExpirationTimer; /** * Set up automatic extension for a lock * @param lock Lock to extend * @param ttl Lock TTL in milliseconds * @param interval Extension interval in milliseconds */ private setupAutoExtension; /** * Stop automatic extension for a lock * @param lock Lock to stop extending */ private stopAutoExtension; } //# sourceMappingURL=memory-lock.d.ts.map