UNPKG

syncguard

Version:

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

19 lines (18 loc) 1.4 kB
/** * SyncGuard - Distributed Lock Library * * Core exports for custom backend implementations and lock helper API. * See: docs/specs/interface.md for complete API contracts and usage patterns. * See: docs/adr/ for architectural decisions (telemetry, retry logic). */ export type { AcquireOk, AcquireResult, AcquisitionOptions, BackendCapabilities, ExtendResult, Fence, HashId, KeyLookup, KeyOp, LockBackend, LockConfig, LockEvent, LockInfo, LockInfoDebug, LockOp, OwnershipLookup, ReleaseResult, TelemetryOptions, } from "./common/types.js"; export type { AsyncLock, DisposableLockHandle, OnReleaseError, } from "./common/disposable.js"; export { acquireHandle, decorateAcquireResult } from "./common/disposable.js"; export { BACKEND_DEFAULTS, BACKEND_LIMITS, FENCE_THRESHOLDS, LOCK_DEFAULTS, MAX_KEY_LENGTH_BYTES, RESERVE_BYTES, } from "./common/constants.js"; export { LockError } from "./common/errors.js"; export { normalizeAndValidateKey, validateLockId, } from "./common/validation.js"; export { generateLockId, hashKey, makeStorageKey } from "./common/crypto.js"; export { lock } from "./common/auto-lock.js"; export { getById, getByIdRaw, getByKey, getByKeyRaw, hasFence, owns, sanitizeLockInfo, } from "./common/helpers.js"; export { withTelemetry } from "./common/telemetry.js"; export { calculateRedisServerTimeMs, isLive, TIME_TOLERANCE_MS, } from "./common/time-predicates.js";