@toa.io/atomicity 1.0.0-alpha.277 → 1.0.0-alpha.282
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/CHANGELOG.md +15 -0
- package/package.json +3 -3
- package/readme.md +2 -2
- package/src/atom.js +10 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.0.0-alpha.282](https://github.com/toa-io/toa/compare/v1.0.0-alpha.281...v1.0.0-alpha.282) (2026-09-03)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **atomicity:** nest every key under atom:<group>:<kind> ([348f39f](https://github.com/toa-io/toa/commit/348f39f72d805a24dd4fdbaa83aede47fe95b894))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# [1.0.0-alpha.278](https://github.com/toa-io/toa/compare/v1.0.0-alpha.277...v1.0.0-alpha.278) (2026-09-03)
|
|
14
|
+
|
|
15
|
+
**Note:** Version bump only for package @toa.io/atomicity
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
6
21
|
# [1.0.0-alpha.277](https://github.com/toa-io/toa/compare/v1.0.0-alpha.276...v1.0.0-alpha.277) (2026-09-03)
|
|
7
22
|
|
|
8
23
|
**Note:** Version bump only for package @toa.io/atomicity
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/atomicity",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.282",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Toa Atomicity Connector",
|
|
6
6
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@sesamecare-oss/redlock": "1.4.0",
|
|
21
|
-
"@toa.io/core": "1.0.0-alpha.
|
|
21
|
+
"@toa.io/core": "1.0.0-alpha.282",
|
|
22
22
|
"ioredis": "6.0.0",
|
|
23
23
|
"n-and-i": "0.3.2",
|
|
24
24
|
"openspan": "1.0.0-alpha.277"
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"scripts": {
|
|
27
27
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "4007c814725dd015d3bbebb9a28e28a247645c4f"
|
|
30
30
|
}
|
package/readme.md
CHANGED
|
@@ -86,5 +86,5 @@ and two tolerate none at all.
|
|
|
86
86
|
One set of clients per process, shared by every atom in it, and an unreachable Redis does not fail
|
|
87
87
|
a start.
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
`
|
|
89
|
+
Keys nest by whose they are, then by what they are for: `atom:<group>:slots:{group}…`,
|
|
90
|
+
`atom:<group>:meter:<key>`, `atom:<group>:lock:<key>`.
|
package/src/atom.js
CHANGED
|
@@ -96,15 +96,16 @@ export class Atom extends Connector {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
* A key names
|
|
100
|
-
* and for a meter is two keys, and two groups using
|
|
99
|
+
* A key names whose it is and then what it is for, under the one namespace every atom
|
|
100
|
+
* shares, so that a name used for a lock and for a meter is two keys, and two groups using
|
|
101
|
+
* the same name do not meet either.
|
|
101
102
|
*
|
|
102
103
|
* @private
|
|
103
104
|
*/
|
|
104
105
|
#keys (kind, keys) {
|
|
105
106
|
if (typeof keys === 'string') keys = [keys]
|
|
106
107
|
|
|
107
|
-
return keys.map((key) => `${
|
|
108
|
+
return keys.map((key) => `${ATOM}:${this.#name}:${kind}:${key}`)
|
|
108
109
|
}
|
|
109
110
|
|
|
110
111
|
async open () {
|
|
@@ -138,7 +139,7 @@ export class Atom extends Connector {
|
|
|
138
139
|
|
|
139
140
|
const loop = discover({
|
|
140
141
|
redis,
|
|
141
|
-
prefix: SLOTS
|
|
142
|
+
prefix: `${ATOM}:${this.#name}:${SLOTS}:`,
|
|
142
143
|
name: this.#name,
|
|
143
144
|
interval: this.#interval,
|
|
144
145
|
signal: this.#abort.signal,
|
|
@@ -167,6 +168,8 @@ const LEASE = 5000
|
|
|
167
168
|
* three different things, so nothing but this keeps a group's lock on a name apart from its
|
|
168
169
|
* meter on the same name.
|
|
169
170
|
*/
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
const
|
|
171
|
+
/** Every key of every atom lives under one namespace, then under its group, then its kind. */
|
|
172
|
+
const ATOM = 'atom'
|
|
173
|
+
const SLOTS = 'slots'
|
|
174
|
+
const METER = 'meter'
|
|
175
|
+
const LOCK = 'lock'
|