UNPKG

syncguard

Version:

Functional TypeScript library for distributed locking across microservices. Prevents race conditions with Redis, Firestore, and custom backends. Features automatic lock management, timeout handling, and extensible architecture.

33 lines (32 loc) 889 B
/** * Configuration options specific to Firestore backend */ export interface FirestoreBackendOptions { /** Firestore collection name for storing locks (default: "locks") */ collection?: string; /** Delay between retries in milliseconds (default: 100) */ retryDelayMs?: number; /** Maximum number of retries (default: 10) */ maxRetries?: number; } /** * Document structure for lock storage in Firestore */ export interface LockDocument { /** Unique identifier for the lock */ lockId: string; /** Timestamp when the lock expires */ expiresAt: number; /** Timestamp when the lock was created */ createdAt: number; /** Lock key for identification */ key: string; } /** * Internal configuration with defaults applied */ export interface FirestoreConfig { collection: string; retryDelayMs: number; maxRetries: number; }