-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.ts
More file actions
90 lines (73 loc) · 1.9 KB
/
index.ts
File metadata and controls
90 lines (73 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// SPDX-FileCopyrightText: 2025-present Kriasoft
// SPDX-License-Identifier: MIT
/**
* 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).
*/
// Core Types
export type {
AcquireOk,
AcquireResult,
AcquisitionOptions,
BackendCapabilities,
ExtendResult,
Fence,
HashId,
KeyLookup,
KeyOp,
LockBackend,
LockConfig,
LockEvent,
LockInfo,
LockInfoDebug,
LockOp,
OwnershipLookup,
ReleaseResult,
TelemetryOptions,
} from "./common/types.js";
// Resource Management (Async Disposal)
export type {
AsyncLock,
DisposableLockHandle,
OnReleaseError,
} from "./common/disposable.js";
export { acquireHandle, decorateAcquireResult } from "./common/disposable.js";
// Configuration Constants
export {
BACKEND_DEFAULTS,
BACKEND_LIMITS,
FENCE_THRESHOLDS,
LOCK_DEFAULTS,
MAX_KEY_LENGTH_BYTES,
RESERVE_BYTES,
} from "./common/constants.js";
// Core Functions and Classes
export { LockError } from "./common/errors.js";
export {
normalizeAndValidateKey,
validateLockId,
} from "./common/validation.js";
export { generateLockId, hashKey, makeStorageKey } from "./common/crypto.js";
// Primary lock API with automatic retry and cleanup
export { lock } from "./common/auto-lock.js";
// Diagnostic helpers for lock inspection and ownership verification
export {
getById,
getByIdRaw,
getByKey,
getByKeyRaw,
hasFence,
owns,
sanitizeLockInfo,
} from "./common/helpers.js";
// Telemetry - Opt-in observability decorator (ADR-007)
export { withTelemetry } from "./common/telemetry.js";
// Time Predicates - Backend implementations use these for lock expiry checks
export {
calculateRedisServerTimeMs,
isLive,
TIME_TOLERANCE_MS,
} from "./common/time-predicates.js";