arbiter_machines 0.1.5 → 0.3.4
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +50 -0
- data/Cargo.lock +307 -0
- data/Cargo.toml +2 -0
- data/README.md +81 -69
- data/ext/arbiter_machines_native/core/CHANGELOG.md +29 -0
- data/ext/arbiter_machines_native/core/Cargo.toml +4 -2
- data/ext/arbiter_machines_native/core/README.md +34 -1
- data/ext/arbiter_machines_native/core/src/lib.rs +214 -63
- data/ext/arbiter_machines_native/ffi/Cargo.toml +2 -1
- data/ext/arbiter_machines_native/ffi/src/arbiter.rs +244 -118
- data/ext/arbiter_machines_native/ffi/src/lib.rs +0 -17
- data/lib/arbiter_machines/version.rb +1 -1
- data/lib/arbiter_machines.rb +25 -0
- data/sig/arbiter_machines.rbs +51 -4
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1315c830ba8c6f4494c8d998f7560366bc09d9955ed0c8d593bbba7cb9676892
|
|
4
|
+
data.tar.gz: fdd5b817e4bf02333cc50ca950e9ac093da84c29cfb83387e7267aca4b308765
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c970ef77ba079390f22cc9facea3663364b89ef053c5cd8e88738b8f2f494b4abd30934b7c01cb2aef1965b585f63b7249667eb93c668258b253be7bb60a094c
|
|
7
|
+
data.tar.gz: b86b0c0c54d847f271014885ae61dc75c5bc5bb7802d669d013ec3820b6b2e55aa32dad65cdbbcad840d21429cbcd8ca9fa9b311f6e3ca58565e968a973b68eb
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.4](https://github.com/seuros/arbiter_machines/compare/arbiter_machines/v0.3.3...arbiter_machines/v0.3.4) (2026-11-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* fix wrapped classes at load so building a value runs no Ruby ([7339ce9](https://github.com/seuros/arbiter_machines/commit/7339ce9e148bbbec3e1a8acfbb82410f45b4e20d))
|
|
9
|
+
|
|
10
|
+
## [0.3.3](https://github.com/seuros/arbiter_machines/compare/arbiter_machines/v0.3.2...arbiter_machines/v0.3.3) (2026-11-16)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* replace runtime indexing in the arbiter core with checked lookups ([5112385](https://github.com/seuros/arbiter_machines/commit/511238591c81c6765c0bdaf844cf5d27afd6ddbb))
|
|
16
|
+
|
|
17
|
+
## [0.3.2](https://github.com/seuros/arbiter_machines/compare/arbiter_machines/v0.3.1...arbiter_machines/v0.3.2) (2026-11-14)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **deps:** require matryona-machines >= 0.4 ([f29f8d2](https://github.com/seuros/arbiter_machines/commit/f29f8d2de1e2f1bb466edf1f2e8a3db7c55b29c1))
|
|
23
|
+
|
|
24
|
+
## [0.3.1](https://github.com/seuros/arbiter_machines/compare/arbiter_machines/v0.3.0...arbiter_machines/v0.3.1) (2026-11-14)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* **deps:** require matryona-machines >= 0.3 ([79ee181](https://github.com/seuros/arbiter_machines/commit/79ee181ef50fa23d47db1746f780057923ba0592))
|
|
30
|
+
|
|
31
|
+
## [0.3.0](https://github.com/seuros/arbiter_machines/compare/arbiter_machines/v0.2.0...arbiter_machines/v0.3.0) (2026-11-14)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### ⚠ BREAKING CHANGES
|
|
35
|
+
|
|
36
|
+
* adopt matryona-machines 0.2 (symbols! tables, exact arrays, frozen-first)
|
|
37
|
+
|
|
38
|
+
### Features
|
|
39
|
+
|
|
40
|
+
* adopt matryona-machines 0.2 (symbols! tables, exact arrays, frozen-first) ([73fb802](https://github.com/seuros/arbiter_machines/commit/73fb8026556f3fb5982c5e65411d9bc03d36c60d))
|
|
41
|
+
|
|
42
|
+
## [0.2.0](https://github.com/seuros/arbiter_machines/compare/arbiter_machines/v0.1.5...arbiter_machines/v0.2.0) (2026-11-14)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### ⚠ BREAKING CHANGES
|
|
46
|
+
|
|
47
|
+
* answer Result with honoured repeats, clone-then-keep acquire, Blocked validated, sealed and resolved at load
|
|
48
|
+
|
|
49
|
+
### Features
|
|
50
|
+
|
|
51
|
+
* answer Result with honoured repeats, clone-then-keep acquire, Blocked validated, sealed and resolved at load ([11a6258](https://github.com/seuros/arbiter_machines/commit/11a6258887d32dd37ea4d2c687528bab463db843))
|
|
52
|
+
|
|
3
53
|
## [0.1.5](https://github.com/seuros/arbiter_machines/compare/arbiter_machines/v0.1.4...arbiter_machines/v0.1.5) (2026-11-06)
|
|
4
54
|
|
|
5
55
|
|
data/Cargo.lock
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "aho-corasick"
|
|
7
|
+
version = "1.1.5"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"memchr",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
[[package]]
|
|
15
|
+
name = "arbiter-machines"
|
|
16
|
+
version = "0.4.1"
|
|
17
|
+
dependencies = [
|
|
18
|
+
"matryona-machines",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[[package]]
|
|
22
|
+
name = "arbiter_machines_native"
|
|
23
|
+
version = "0.1.6"
|
|
24
|
+
dependencies = [
|
|
25
|
+
"arbiter-machines",
|
|
26
|
+
"magnus",
|
|
27
|
+
"matryona-machines",
|
|
28
|
+
"rb-sys",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[[package]]
|
|
32
|
+
name = "bindgen"
|
|
33
|
+
version = "0.72.1"
|
|
34
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
35
|
+
checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
|
|
36
|
+
dependencies = [
|
|
37
|
+
"bitflags",
|
|
38
|
+
"cexpr",
|
|
39
|
+
"clang-sys",
|
|
40
|
+
"itertools",
|
|
41
|
+
"proc-macro2",
|
|
42
|
+
"quote",
|
|
43
|
+
"regex",
|
|
44
|
+
"rustc-hash",
|
|
45
|
+
"shlex",
|
|
46
|
+
"syn",
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[[package]]
|
|
50
|
+
name = "bitflags"
|
|
51
|
+
version = "2.13.2"
|
|
52
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
53
|
+
checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
|
|
54
|
+
|
|
55
|
+
[[package]]
|
|
56
|
+
name = "bytes"
|
|
57
|
+
version = "1.12.1"
|
|
58
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
59
|
+
checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
|
|
60
|
+
|
|
61
|
+
[[package]]
|
|
62
|
+
name = "cexpr"
|
|
63
|
+
version = "0.6.0"
|
|
64
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
65
|
+
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
|
|
66
|
+
dependencies = [
|
|
67
|
+
"nom",
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
[[package]]
|
|
71
|
+
name = "cfg-if"
|
|
72
|
+
version = "1.0.5"
|
|
73
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
74
|
+
checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
|
|
75
|
+
|
|
76
|
+
[[package]]
|
|
77
|
+
name = "clang-sys"
|
|
78
|
+
version = "1.9.1"
|
|
79
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
80
|
+
checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a"
|
|
81
|
+
dependencies = [
|
|
82
|
+
"glob",
|
|
83
|
+
"libc",
|
|
84
|
+
"libloading",
|
|
85
|
+
]
|
|
86
|
+
|
|
87
|
+
[[package]]
|
|
88
|
+
name = "either"
|
|
89
|
+
version = "1.19.0"
|
|
90
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
91
|
+
checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
|
|
92
|
+
|
|
93
|
+
[[package]]
|
|
94
|
+
name = "glob"
|
|
95
|
+
version = "0.3.4"
|
|
96
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
97
|
+
checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b"
|
|
98
|
+
|
|
99
|
+
[[package]]
|
|
100
|
+
name = "itertools"
|
|
101
|
+
version = "0.13.0"
|
|
102
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
103
|
+
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
|
|
104
|
+
dependencies = [
|
|
105
|
+
"either",
|
|
106
|
+
]
|
|
107
|
+
|
|
108
|
+
[[package]]
|
|
109
|
+
name = "lazy_static"
|
|
110
|
+
version = "1.5.1"
|
|
111
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
112
|
+
checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb"
|
|
113
|
+
|
|
114
|
+
[[package]]
|
|
115
|
+
name = "libc"
|
|
116
|
+
version = "0.2.191"
|
|
117
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
118
|
+
checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
|
|
119
|
+
|
|
120
|
+
[[package]]
|
|
121
|
+
name = "libloading"
|
|
122
|
+
version = "0.8.9"
|
|
123
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
124
|
+
checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
|
|
125
|
+
dependencies = [
|
|
126
|
+
"cfg-if",
|
|
127
|
+
"windows-link",
|
|
128
|
+
]
|
|
129
|
+
|
|
130
|
+
[[package]]
|
|
131
|
+
name = "magnus"
|
|
132
|
+
version = "0.9.3"
|
|
133
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
134
|
+
checksum = "40ef424404d166cbb71c8b8d19c9c589c748c4547c1afa1928c5504299f6c713"
|
|
135
|
+
dependencies = [
|
|
136
|
+
"bytes",
|
|
137
|
+
"magnus-macros",
|
|
138
|
+
"rb-sys",
|
|
139
|
+
"rb-sys-env",
|
|
140
|
+
"seq-macro",
|
|
141
|
+
]
|
|
142
|
+
|
|
143
|
+
[[package]]
|
|
144
|
+
name = "magnus-macros"
|
|
145
|
+
version = "0.9.1"
|
|
146
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
147
|
+
checksum = "9dafde2eeb66f090e0f326112323eb8324b12cb32b5d1210e541d3df6b0ce77e"
|
|
148
|
+
dependencies = [
|
|
149
|
+
"proc-macro2",
|
|
150
|
+
"quote",
|
|
151
|
+
"syn",
|
|
152
|
+
]
|
|
153
|
+
|
|
154
|
+
[[package]]
|
|
155
|
+
name = "matryona-machines"
|
|
156
|
+
version = "0.6.0"
|
|
157
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
158
|
+
checksum = "cf8a06ab02efd767270815a1f515a40bbf3bfc77038e9360676ebe8d47833b07"
|
|
159
|
+
dependencies = [
|
|
160
|
+
"magnus",
|
|
161
|
+
]
|
|
162
|
+
|
|
163
|
+
[[package]]
|
|
164
|
+
name = "memchr"
|
|
165
|
+
version = "2.8.3"
|
|
166
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
167
|
+
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
|
168
|
+
|
|
169
|
+
[[package]]
|
|
170
|
+
name = "minimal-lexical"
|
|
171
|
+
version = "0.2.1"
|
|
172
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
173
|
+
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
|
174
|
+
|
|
175
|
+
[[package]]
|
|
176
|
+
name = "nom"
|
|
177
|
+
version = "7.1.3"
|
|
178
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
179
|
+
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
|
|
180
|
+
dependencies = [
|
|
181
|
+
"memchr",
|
|
182
|
+
"minimal-lexical",
|
|
183
|
+
]
|
|
184
|
+
|
|
185
|
+
[[package]]
|
|
186
|
+
name = "proc-macro2"
|
|
187
|
+
version = "1.0.107"
|
|
188
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
189
|
+
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
|
190
|
+
dependencies = [
|
|
191
|
+
"unicode-ident",
|
|
192
|
+
]
|
|
193
|
+
|
|
194
|
+
[[package]]
|
|
195
|
+
name = "quote"
|
|
196
|
+
version = "1.0.47"
|
|
197
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
198
|
+
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
|
199
|
+
dependencies = [
|
|
200
|
+
"proc-macro2",
|
|
201
|
+
]
|
|
202
|
+
|
|
203
|
+
[[package]]
|
|
204
|
+
name = "rb-sys"
|
|
205
|
+
version = "0.9.130"
|
|
206
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
207
|
+
checksum = "02faf625bb10ba893e3ae620f19c9fb1b5f8fcae0fe4eb86bb3f2230fad75edb"
|
|
208
|
+
dependencies = [
|
|
209
|
+
"rb-sys-build",
|
|
210
|
+
]
|
|
211
|
+
|
|
212
|
+
[[package]]
|
|
213
|
+
name = "rb-sys-build"
|
|
214
|
+
version = "0.9.130"
|
|
215
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
216
|
+
checksum = "05be6f9c86fe5482808162826f6c047d093b3670582296c770de1d94f8066694"
|
|
217
|
+
dependencies = [
|
|
218
|
+
"bindgen",
|
|
219
|
+
"lazy_static",
|
|
220
|
+
"proc-macro2",
|
|
221
|
+
"quote",
|
|
222
|
+
"regex",
|
|
223
|
+
"shell-words",
|
|
224
|
+
"syn",
|
|
225
|
+
]
|
|
226
|
+
|
|
227
|
+
[[package]]
|
|
228
|
+
name = "rb-sys-env"
|
|
229
|
+
version = "0.2.3"
|
|
230
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
231
|
+
checksum = "cca7ad6a7e21e72151d56fe2495a259b5670e204c3adac41ee7ef676ea08117a"
|
|
232
|
+
|
|
233
|
+
[[package]]
|
|
234
|
+
name = "regex"
|
|
235
|
+
version = "1.13.1"
|
|
236
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
237
|
+
checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d"
|
|
238
|
+
dependencies = [
|
|
239
|
+
"aho-corasick",
|
|
240
|
+
"memchr",
|
|
241
|
+
"regex-automata",
|
|
242
|
+
"regex-syntax",
|
|
243
|
+
]
|
|
244
|
+
|
|
245
|
+
[[package]]
|
|
246
|
+
name = "regex-automata"
|
|
247
|
+
version = "0.4.18"
|
|
248
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
249
|
+
checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2"
|
|
250
|
+
dependencies = [
|
|
251
|
+
"aho-corasick",
|
|
252
|
+
"memchr",
|
|
253
|
+
"regex-syntax",
|
|
254
|
+
]
|
|
255
|
+
|
|
256
|
+
[[package]]
|
|
257
|
+
name = "regex-syntax"
|
|
258
|
+
version = "0.8.11"
|
|
259
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
260
|
+
checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
|
|
261
|
+
|
|
262
|
+
[[package]]
|
|
263
|
+
name = "rustc-hash"
|
|
264
|
+
version = "2.1.3"
|
|
265
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
266
|
+
checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
|
|
267
|
+
|
|
268
|
+
[[package]]
|
|
269
|
+
name = "seq-macro"
|
|
270
|
+
version = "0.3.6"
|
|
271
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
272
|
+
checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
|
|
273
|
+
|
|
274
|
+
[[package]]
|
|
275
|
+
name = "shell-words"
|
|
276
|
+
version = "1.1.1"
|
|
277
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
278
|
+
checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77"
|
|
279
|
+
|
|
280
|
+
[[package]]
|
|
281
|
+
name = "shlex"
|
|
282
|
+
version = "1.3.0"
|
|
283
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
284
|
+
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
|
285
|
+
|
|
286
|
+
[[package]]
|
|
287
|
+
name = "syn"
|
|
288
|
+
version = "2.0.119"
|
|
289
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
290
|
+
checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
|
|
291
|
+
dependencies = [
|
|
292
|
+
"proc-macro2",
|
|
293
|
+
"quote",
|
|
294
|
+
"unicode-ident",
|
|
295
|
+
]
|
|
296
|
+
|
|
297
|
+
[[package]]
|
|
298
|
+
name = "unicode-ident"
|
|
299
|
+
version = "1.0.27"
|
|
300
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
301
|
+
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
|
|
302
|
+
|
|
303
|
+
[[package]]
|
|
304
|
+
name = "windows-link"
|
|
305
|
+
version = "0.2.1"
|
|
306
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
307
|
+
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
data/Cargo.toml
CHANGED
|
@@ -4,6 +4,7 @@ default-members = ["ext/arbiter_machines_native/core"]
|
|
|
4
4
|
resolver = "3"
|
|
5
5
|
[workspace.dependencies]
|
|
6
6
|
arbiter-machines = { path = "ext/arbiter_machines_native/core" }
|
|
7
|
+
matryona-machines = { version = ">=0.6", default-features = false }
|
|
7
8
|
magnus = { version = "0.9.3", default-features = false }
|
|
8
9
|
rb-sys = { version = "0.9.130", default-features = false, features = ["stable-api-compiled-fallback"] }
|
|
9
10
|
[workspace.package]
|
|
@@ -13,6 +14,7 @@ license = "MIT"
|
|
|
13
14
|
[workspace.lints.rust]
|
|
14
15
|
unsafe_code = "deny"
|
|
15
16
|
unused_must_use = "warn"
|
|
17
|
+
missing_docs = "warn"
|
|
16
18
|
[workspace.lints.clippy]
|
|
17
19
|
all = { level = "warn", priority = -1 }
|
|
18
20
|
pedantic = { level = "warn", priority = -1 }
|
data/README.md
CHANGED
|
@@ -13,21 +13,18 @@ gem 'arbiter_machines'
|
|
|
13
13
|
```ruby
|
|
14
14
|
# Two tasks: a janitor at priority 1, a payment at priority 10.
|
|
15
15
|
# One resource: the ledger lock, ceiling 10.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
arbiter.
|
|
24
|
-
arbiter.
|
|
25
|
-
|
|
26
|
-
arbiter.release(task: 0, resource: 0) # => true janitor done, wait cleared
|
|
27
|
-
arbiter.acquire(task: 1, resource: 0) # => [:granted, nil] payment retries and gets in
|
|
16
|
+
# Positional, like the Rust constructor: base priorities, ceilings, protocol.
|
|
17
|
+
arbiter = ArbiterMachines::Arbiter.new([1, 10], [10], :inheritance)
|
|
18
|
+
|
|
19
|
+
arbiter.acquire(0, 0) # => :granted, janitor takes the ledger
|
|
20
|
+
arbiter.acquire(1, 0) # => #<data ArbiterMachines::Blocked resource=0>, payment waits
|
|
21
|
+
arbiter.effective_priorities # => [10, 10], janitor now runs as urgent
|
|
22
|
+
|
|
23
|
+
arbiter.release(0, 0) # => :released, janitor done, wait cleared
|
|
24
|
+
arbiter.acquire(1, 0) # => :granted, payment retries and gets in
|
|
28
25
|
```
|
|
29
26
|
|
|
30
|
-
Tasks and resources are
|
|
27
|
+
Tasks and resources are indices into the arrays you passed in: `acquire(task, resource)`. Larger number means more urgent.
|
|
31
28
|
|
|
32
29
|
## A Message to the Resistance
|
|
33
30
|
|
|
@@ -66,8 +63,8 @@ Every resource is either free or held. Every task is either running, holding, or
|
|
|
66
63
|
stateDiagram-v2
|
|
67
64
|
[*] --> free
|
|
68
65
|
free --> held: acquire, granted
|
|
69
|
-
held --> held: holder acquires again, already_owned
|
|
70
|
-
held --> held: other task acquires,
|
|
66
|
+
held --> held: holder acquires again, already_owned (nothing changes)
|
|
67
|
+
held --> held: other task acquires, Blocked (holder inherits urgency)
|
|
71
68
|
held --> free: holder releases, waiters cleared to retry
|
|
72
69
|
held --> held: acquire would close a wait loop, deadlock (nothing changes)
|
|
73
70
|
free --> [*]
|
|
@@ -81,20 +78,20 @@ sequenceDiagram
|
|
|
81
78
|
participant A as Arbiter
|
|
82
79
|
participant P as Payment (task 1, prio 10)
|
|
83
80
|
|
|
84
|
-
J->>A: acquire(
|
|
81
|
+
J->>A: acquire(0, 0)
|
|
85
82
|
A-->>J: granted
|
|
86
83
|
Note over J: starts vacuuming the ledger
|
|
87
84
|
|
|
88
|
-
P->>A: acquire(
|
|
89
|
-
A-->>P:
|
|
85
|
+
P->>A: acquire(1, 0)
|
|
86
|
+
A-->>P: Blocked(resource 0)
|
|
90
87
|
Note over A: effective priorities now [10, 10]
|
|
91
88
|
Note over J: runs as priority 10, no report builder gets ahead
|
|
92
89
|
|
|
93
|
-
J->>A: release(
|
|
94
|
-
A-->>J:
|
|
90
|
+
J->>A: release(0, 0)
|
|
91
|
+
A-->>J: released
|
|
95
92
|
Note over A: effective priorities back to [1, 10], wait cleared
|
|
96
93
|
|
|
97
|
-
P->>A: acquire(
|
|
94
|
+
P->>A: acquire(1, 0)
|
|
98
95
|
A-->>P: granted
|
|
99
96
|
```
|
|
100
97
|
|
|
@@ -102,17 +99,18 @@ sequenceDiagram
|
|
|
102
99
|
|
|
103
100
|
### Acquire
|
|
104
101
|
|
|
105
|
-
`acquire`
|
|
102
|
+
`acquire(task, resource)` answers `:granted`, `:already_owned`, or a `Blocked` naming the resource you're waiting on. Anything else is a refusal symbol.
|
|
106
103
|
|
|
107
104
|
```ruby
|
|
108
|
-
arbiter = ArbiterMachines::Arbiter.new(
|
|
109
|
-
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
arbiter.acquire(
|
|
113
|
-
arbiter.acquire(
|
|
114
|
-
arbiter.acquire(
|
|
115
|
-
arbiter.
|
|
105
|
+
arbiter = ArbiterMachines::Arbiter.new([1, 5, 10], [10, 10], :inheritance)
|
|
106
|
+
|
|
107
|
+
arbiter.acquire(0, 0) # => :granted
|
|
108
|
+
arbiter.acquire(0, 0) # => :already_owned, a repeat: nothing changes
|
|
109
|
+
arbiter.acquire(1, 1) # => :granted
|
|
110
|
+
arbiter.acquire(1, 0) # => #<data ArbiterMachines::Blocked resource=0>
|
|
111
|
+
arbiter.acquire(1, 0) # => the same Blocked again, nothing changes
|
|
112
|
+
arbiter.owner(0) # => 0
|
|
113
|
+
arbiter.waiting_on(1) # => 0
|
|
116
114
|
```
|
|
117
115
|
|
|
118
116
|
Task 1 now holds resource 1 and is waiting on resource 0, which task 0 holds.
|
|
@@ -122,8 +120,8 @@ Task 1 now holds resource 1 and is waiting on resource 0, which task 0 holds.
|
|
|
122
120
|
Urgency flows up the chain. If a third task waits on task 1, task 1 gets its priority, and so does task 0 behind it.
|
|
123
121
|
|
|
124
122
|
```ruby
|
|
125
|
-
arbiter.acquire(
|
|
126
|
-
arbiter.effective_priorities
|
|
123
|
+
arbiter.acquire(2, 1) # => #<data ArbiterMachines::Blocked resource=1>
|
|
124
|
+
arbiter.effective_priorities # => [10, 10, 10]
|
|
127
125
|
```
|
|
128
126
|
|
|
129
127
|
Task 2, priority 10, waits on task 1. Task 1 waits on task 0. Everybody in the chain runs at 10 until the chain clears.
|
|
@@ -133,27 +131,26 @@ Task 2, priority 10, waits on task 1. Task 1 waits on task 0. Everybody in the c
|
|
|
133
131
|
Releasing clears the waits on that resource. It does not hand the resource to anyone. The waiters call `acquire` again, and the arbiter decides fresh.
|
|
134
132
|
|
|
135
133
|
```ruby
|
|
136
|
-
arbiter.release(
|
|
137
|
-
arbiter.effective_priorities
|
|
138
|
-
arbiter.acquire(
|
|
134
|
+
arbiter.release(0, 0) # => :released
|
|
135
|
+
arbiter.effective_priorities # => [1, 10, 10] task 1 still blocks task 2
|
|
136
|
+
arbiter.acquire(1, 0) # => :granted
|
|
139
137
|
```
|
|
140
138
|
|
|
141
|
-
Release by a task that doesn't hold the resource
|
|
139
|
+
Release by a task that doesn't hold the resource is `:wrong_owner`, and of a resource nobody holds `:unowned`. Both change nothing. A second release of the same resource is `:unowned` too: the arbiter keeps no history, so it can't prove you were the one who held it.
|
|
142
140
|
|
|
143
141
|
### Stop waiting
|
|
144
142
|
|
|
145
143
|
A task that gives up on a door calls `cancel_wait`. Its held resources stay held. Only the wait is dropped, and the urgency it was lending goes with it.
|
|
146
144
|
|
|
147
145
|
```ruby
|
|
148
|
-
arbiter = ArbiterMachines::Arbiter.new(
|
|
149
|
-
|
|
150
|
-
)
|
|
151
|
-
arbiter.
|
|
152
|
-
|
|
153
|
-
arbiter.
|
|
154
|
-
|
|
155
|
-
arbiter.
|
|
156
|
-
arbiter.effective_priorities # => [1, 5, 10]
|
|
146
|
+
arbiter = ArbiterMachines::Arbiter.new([1, 5, 10], [10, 10], :inheritance)
|
|
147
|
+
arbiter.acquire(0, 0)
|
|
148
|
+
arbiter.acquire(2, 0) # => #<data ArbiterMachines::Blocked resource=0>
|
|
149
|
+
arbiter.effective_priorities # => [10, 5, 10]
|
|
150
|
+
|
|
151
|
+
arbiter.cancel_wait(2) # => :cancelled
|
|
152
|
+
arbiter.cancel_wait(2) # => :not_waiting, a repeat: nothing changes
|
|
153
|
+
arbiter.effective_priorities # => [1, 5, 10]
|
|
157
154
|
```
|
|
158
155
|
|
|
159
156
|
### Deadlock is refused, not reported after the fact
|
|
@@ -161,17 +158,15 @@ arbiter.effective_priorities # => [1, 5, 10]
|
|
|
161
158
|
Two tasks each holding what the other wants is a loop. The arbiter sees it before charting the second wait and returns `:deadlock`. Nothing about the current state changes, so you can back out cleanly.
|
|
162
159
|
|
|
163
160
|
```ruby
|
|
164
|
-
arbiter = ArbiterMachines::Arbiter.new(
|
|
165
|
-
|
|
166
|
-
)
|
|
167
|
-
arbiter.acquire(
|
|
168
|
-
arbiter.acquire(
|
|
169
|
-
arbiter.
|
|
170
|
-
|
|
171
|
-
arbiter.
|
|
172
|
-
|
|
173
|
-
arbiter.cancel_wait(task: 0) # => true, task 0 backs off
|
|
174
|
-
arbiter.acquire(task: 1, resource: 0) # => [:blocked, 0] now it's a plain wait
|
|
161
|
+
arbiter = ArbiterMachines::Arbiter.new([1, 5, 10], [10, 10], :inheritance)
|
|
162
|
+
arbiter.acquire(0, 0)
|
|
163
|
+
arbiter.acquire(1, 1)
|
|
164
|
+
arbiter.acquire(0, 1) # => #<data ArbiterMachines::Blocked resource=1>
|
|
165
|
+
arbiter.acquire(1, 0) # => :deadlock
|
|
166
|
+
arbiter.effective_priorities # => [1, 5, 10] untouched
|
|
167
|
+
|
|
168
|
+
arbiter.cancel_wait(0) # => :cancelled, task 0 backs off
|
|
169
|
+
arbiter.acquire(1, 0) # => #<data ArbiterMachines::Blocked resource=0> now a plain wait
|
|
175
170
|
```
|
|
176
171
|
|
|
177
172
|
### The other protocol: immediate ceiling
|
|
@@ -179,28 +174,45 @@ arbiter.acquire(task: 1, resource: 0) # => [:blocked, 0] now it's a plain wai
|
|
|
179
174
|
With `:immediate_ceiling`, a task jumps to the resource's ceiling the moment it takes the resource, before anyone has to wait. Nobody with a priority at or below the ceiling can get in behind it.
|
|
180
175
|
|
|
181
176
|
```ruby
|
|
182
|
-
arbiter = ArbiterMachines::Arbiter.new(
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
arbiter.acquire(
|
|
186
|
-
arbiter.
|
|
187
|
-
arbiter.acquire(task: 1, resource: 1) # => [:blocked, 0] priority 5 can't clear a ceiling of 8
|
|
188
|
-
arbiter.acquire(task: 2, resource: 1) # => [:granted, nil] priority 10 can
|
|
177
|
+
arbiter = ArbiterMachines::Arbiter.new([1, 5, 10], [8, 10], :immediate_ceiling)
|
|
178
|
+
arbiter.acquire(0, 0) # => :granted
|
|
179
|
+
arbiter.effective_priorities # => [8, 5, 10] task 0 raised to the ceiling
|
|
180
|
+
arbiter.acquire(1, 1) # => Blocked resource=0, priority 5 can't clear a ceiling of 8
|
|
181
|
+
arbiter.acquire(2, 1) # => :granted, priority 10 can
|
|
189
182
|
```
|
|
190
183
|
|
|
191
184
|
A ceiling has to be at least as high as every task that will ever take the resource. Task 2 at priority 10 asking for resource 0 with ceiling 8 is a misdeclaration, and the arbiter says so:
|
|
192
185
|
|
|
193
186
|
```ruby
|
|
194
|
-
arbiter.acquire(
|
|
187
|
+
arbiter.acquire(2, 0) # => :above_ceiling
|
|
195
188
|
```
|
|
196
189
|
|
|
197
190
|
## The Rules of the Vessel
|
|
198
191
|
|
|
199
|
-
- **
|
|
200
|
-
- **
|
|
201
|
-
- **
|
|
202
|
-
-
|
|
192
|
+
- **Ruby mirrors the Rust core.** `Arbiter.new(base, ceilings, protocol)` takes its arguments positionally, in the order of `Arbiter::new`. `acquire(task, resource)`, `release(task, resource)`, `cancel_wait(task)`, `effective_priorities`, `owner(resource)`, `waiting_on(task)`, `protocol`, `task_count` and `resource_count` are the core's methods under the core's names.
|
|
193
|
+
- **Up to 8 tasks and 8 resources**, chosen independently by the lengths of `base` and `ceilings`: every count in `0..8` is compiled in, and `Arbiter::TASK_CAPACITY` and `Arbiter::RESOURCE_CAPACITY` say so. A longer array raises `RangeError`.
|
|
194
|
+
- **Priorities and ceilings are Integers** in `0..2**32-1`; **indices are non-negative Integers**. Floats, strings and nil raise `TypeError`, so does a `base` or `ceilings` that isn't an Array or a `protocol` that isn't a Symbol. A value out of range, or a protocol other than `:inheritance` and `:immediate_ceiling`, raises `RangeError`. `ArgumentError` is only ever Ruby's own, for the wrong number of arguments.
|
|
195
|
+
- **An index past your tasks or resources is a refusal, not an exception**: `:unknown_task` or `:unknown_resource`. `owner` and `waiting_on` answer `nil` for it.
|
|
196
|
+
- **Refusals don't raise and don't change anything.** Not an owner, not a wait, not a priority. Every reason has its own symbol, the snake case of the core's `Refusal` variant; there is no catch-all.
|
|
197
|
+
- **A task waits or runs, never both.** A task that calls `acquire` is running, so `:granted` drops a wait it had on another resource and a new `Blocked` replaces it. The answer doesn't name the dropped wait: you already have it (the `Blocked` you got and didn't cancel), and `waiting_on(task)` reads it before the call. If you keep your own waiter queues, call `cancel_wait` when a task gives up a wait.
|
|
198
|
+
- **Repeats are honoured when the arbiter can prove them.** `acquire` of a resource the task already owns is `:already_owned`. `acquire` while the same resource still blocks the task answers the same `Blocked` again. `cancel_wait` of a task that isn't waiting is `:not_waiting`. None of them changes anything. A repeated `release` can't be proven, because the arbiter keeps no history of who held what: it is `:unowned`.
|
|
199
|
+
- **`Blocked` is a value, and values are valid or don't exist.** `ArbiterMachines::Blocked.new(resource)` is checked by the native extension whether the arbiter built it or you did: a non-Integer raises `TypeError`, a negative or oversized index `RangeError`. `==` compares it by value. It is sealed: subclassing it raises `TypeError` and `allocate` is gone. Sealing stops accidents, not reflection (a named `class X < Blocked` still binds `X` before raising, and `Data#initialize` can be bound directly), but the arbiter reads no `Blocked` from you, so a forged one reaches nothing and never equals a real answer.
|
|
200
|
+
- **No scopes, no restarts to plan for.** The arbiter issues no ids, tokens or handles; tasks and resources are your own indices. A new arbiter starts with nothing owned and nobody waiting.
|
|
201
|
+
- **No clock.** The arbiter reads no time and records none. Nothing it answers depends on when you ask.
|
|
202
|
+
- **Every answer, by method.**
|
|
203
|
+
|
|
204
|
+
| Method | Honoured | Refused | Records the clock |
|
|
205
|
+
| --- | --- | --- | --- |
|
|
206
|
+
| `acquire(task, resource)` | `:granted`, `:already_owned` (a repeat), a `Blocked` (the wait is recorded; the same `Blocked` again changes nothing) | `:unknown_task`, `:unknown_resource`, `:above_ceiling`, `:deadlock` | no clock, nothing recorded |
|
|
207
|
+
| `release(task, resource)` | `:released` | `:unknown_task`, `:unknown_resource`, `:unowned` (a repeated release included), `:wrong_owner` | no clock, nothing recorded |
|
|
208
|
+
| `cancel_wait(task)` | `:cancelled`, `:not_waiting` (a repeat) | `:unknown_task` | no clock, nothing recorded |
|
|
209
|
+
| `effective_priorities` | an Array of Integers, one per task, fresh every call | never refuses | no clock, nothing recorded |
|
|
210
|
+
| `owner(resource)` | the owning task, `nil` when free or no such resource | never refuses | no clock, nothing recorded |
|
|
211
|
+
| `waiting_on(task)` | the resource waited on, `nil` when not waiting or no such task | never refuses | no clock, nothing recorded |
|
|
212
|
+
| `Blocked.new(resource)` | the value | never refuses; an invalid value raises `RangeError` (`TypeError` for a non-Integer) | no clock, nothing recorded |
|
|
213
|
+
|
|
203
214
|
- **Frozen means frozen.** `freeze` the arbiter and `acquire`, `release`, and `cancel_wait` raise `FrozenError`. Reads still work.
|
|
215
|
+
- **The binding never loses work.** A `Blocked` answer is built by calling `Blocked.new`, which is Ruby code, so `acquire` decides on a copy and keeps it only once the answer exists. If building it raises, that exception propagates and nothing is applied. If it freezes the arbiter, `FrozenError`; if it calls back in and changes the arbiter, `RuntimeError`; in both cases nothing is applied. The `Blocked` class is resolved once, when the extension loads: reassigning the constant later changes nothing the arbiter builds.
|
|
204
216
|
- **Ceilings are always required**, even under `:inheritance`, where they're not consulted.
|
|
205
217
|
|
|
206
218
|
## What You Think You're Doing vs Reality
|
|
@@ -212,7 +224,7 @@ A priority is a promise about scheduling, not about locks. The moment a high-pri
|
|
|
212
224
|
|
|
213
225
|
## What's Yours
|
|
214
226
|
|
|
215
|
-
The arbiter never touches a mutex, a thread, or a scheduler. When it says `:granted`, you take the lock. When it
|
|
227
|
+
The arbiter never touches a mutex, a thread, or a scheduler. When it says `:granted`, you take the lock. When it answers a `Blocked`, you wait however you wait, then ask again after the holder releases. When it reports an effective priority, you're the one who has to tell your scheduler. Keep one arbiter per group of resources, and keep its calls serialized.
|
|
216
228
|
|
|
217
229
|
## License
|
|
218
230
|
|