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.
18 lines (17 loc) • 669 B
TypeScript
import { LockError } from "../common/backend.js";
/**
* Checks if an AbortSignal has been aborted and throws LockError if so.
* Redis backend uses pre-dispatch checking since ioredis does not accept AbortSignal parameters.
*
* @param signal - Optional AbortSignal to check
* @throws LockError("Aborted") if signal is aborted
*/
export declare function checkAborted(signal?: AbortSignal): void;
/**
* Maps Redis client errors to standardized LockError codes.
*
* @param error - Redis client error or string
* @returns LockError with appropriate code and context
* @see docs/specs/interface.md
*/
export declare function mapRedisError(error: any): LockError;