@omnitron-dev/titan-lock 0.3.5 → 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -7
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,19 +1,33 @@
|
|
|
1
1
|
# @omnitron-dev/titan-lock
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Redis-backed lock ownership, expiry and renewal for cooperating Titan services.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Capabilities
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- Atomic acquisition, release and extension with ownership IDs.
|
|
8
|
+
- Configurable TTL, retries and backoff.
|
|
9
|
+
- `withLock` and decorators for protected operations.
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```sh
|
|
10
14
|
pnpm add @omnitron-dev/titan-lock
|
|
11
15
|
```
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
```ts
|
|
18
|
+
import { TitanLockModule } from '@omnitron-dev/titan-lock';
|
|
19
|
+
|
|
20
|
+
export const lock = TitanLockModule.forRoot({ keyPrefix: 'app:locks', defaultTtl: 30_000 });
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Add this dynamic module to the `imports` of an existing Titan application.
|
|
24
|
+
|
|
25
|
+
Register Titan Redis first; the lock module resolves its client through `REDIS_MANAGER`. `withLock` renews by default while its callback runs. Applications still own transaction boundaries and reconciliation after a lost response or expired lease. A lock does not provide a universal deadlock-prevention guarantee.
|
|
26
|
+
|
|
27
|
+
## Documentation
|
|
14
28
|
|
|
15
|
-
|
|
29
|
+
[Public API](src/index.ts) · [Package exports](package.json) · [Omni](../../README.md)
|
|
16
30
|
|
|
17
31
|
## License
|
|
18
32
|
|
|
19
|
-
MIT
|
|
33
|
+
[MIT](../../LICENSE).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnitron-dev/titan-lock",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.8",
|
|
4
4
|
"description": "Distributed lock module for Titan framework with Redis-backed locking",
|
|
5
5
|
"author": "LuxQuant",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@omnitron-dev/titan": "0.
|
|
21
|
-
"@omnitron-dev/titan-redis": "0.
|
|
20
|
+
"@omnitron-dev/titan": "0.4.8",
|
|
21
|
+
"@omnitron-dev/titan-redis": "0.4.8"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@omnitron-dev/titan": "0.
|
|
25
|
-
"@omnitron-dev/titan-redis": "0.
|
|
24
|
+
"@omnitron-dev/titan": "0.4.8",
|
|
25
|
+
"@omnitron-dev/titan-redis": "0.4.8",
|
|
26
26
|
"@types/node": "26.6.6",
|
|
27
27
|
"reflect-metadata": "^0.2.2",
|
|
28
28
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"url": "git+https://github.com/omnitron-dev/omni.git",
|
|
35
35
|
"directory": "packages/titan-lock"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "1ae8568eebc2581e2cc2428bd3ca1cf570ed3f03",
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "../../scripts/build-package.sh -p ./tsconfig.json",
|
|
40
40
|
"test": "vitest run",
|