prometheus-client-mmap 1.1.0-x86_64-linux → 1.1.2-x86_64-linux
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/ext/fast_mmaped_file_rs/Cargo.lock +198 -161
- data/ext/fast_mmaped_file_rs/Cargo.toml +8 -8
- data/ext/fast_mmaped_file_rs/src/error.rs +0 -8
- data/ext/fast_mmaped_file_rs/src/mmap/inner.rs +13 -38
- data/ext/fast_mmaped_file_rs/src/mmap.rs +18 -75
- data/lib/2.7/fast_mmaped_file_rs.so +0 -0
- data/lib/3.0/fast_mmaped_file_rs.so +0 -0
- data/lib/3.1/fast_mmaped_file_rs.so +0 -0
- data/lib/3.2/fast_mmaped_file_rs.so +0 -0
- data/lib/prometheus/client/version.rb +1 -1
- metadata +20 -7
- data/lib/3.3/fast_mmaped_file_rs.so +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8717d2500dfd8d8683b5e2bbec5ac9ed6a4a98b043149ac3c5d4e8bb9489f8f
|
4
|
+
data.tar.gz: bb38c72932e737c55354a8969732e08617b0aa233d3c83bcb72f478dc6329f08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1aa4ea653e6894d7674623c788eaf151dc1723e9419db8d945e393c18338f2c4ecb4bd20c568f39bce744af5eb3c5aba131e8bae027cb2296eb09f8656da19e5
|
7
|
+
data.tar.gz: f58ddd49ab0cdf4205cdd648c44aeddf5a95877b02e03760a193c615a773e282a38d733120920a2a5ab3dd2d1a508d28c0c1cb6460f515c2de5a01c889e19212
|
@@ -4,42 +4,49 @@ version = 3
|
|
4
4
|
|
5
5
|
[[package]]
|
6
6
|
name = "ahash"
|
7
|
-
version = "0.8.
|
7
|
+
version = "0.8.11"
|
8
8
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
9
|
-
checksum = "
|
9
|
+
checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
|
10
10
|
dependencies = [
|
11
11
|
"cfg-if",
|
12
12
|
"once_cell",
|
13
13
|
"version_check",
|
14
|
+
"zerocopy",
|
14
15
|
]
|
15
16
|
|
16
17
|
[[package]]
|
17
18
|
name = "aho-corasick"
|
18
|
-
version = "
|
19
|
+
version = "1.1.3"
|
19
20
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
20
|
-
checksum = "
|
21
|
+
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
21
22
|
dependencies = [
|
22
23
|
"memchr",
|
23
24
|
]
|
24
25
|
|
26
|
+
[[package]]
|
27
|
+
name = "allocator-api2"
|
28
|
+
version = "0.2.18"
|
29
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
30
|
+
checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f"
|
31
|
+
|
25
32
|
[[package]]
|
26
33
|
name = "autocfg"
|
27
|
-
version = "1.
|
34
|
+
version = "1.4.0"
|
28
35
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
29
|
-
checksum = "
|
36
|
+
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
30
37
|
|
31
38
|
[[package]]
|
32
39
|
name = "bindgen"
|
33
|
-
version = "0.69.
|
40
|
+
version = "0.69.4"
|
34
41
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
35
|
-
checksum = "
|
42
|
+
checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0"
|
36
43
|
dependencies = [
|
37
|
-
"bitflags 2.
|
44
|
+
"bitflags 2.6.0",
|
38
45
|
"cexpr",
|
39
46
|
"clang-sys",
|
47
|
+
"itertools",
|
40
48
|
"lazy_static",
|
41
49
|
"lazycell",
|
42
|
-
"peeking_take_while",
|
43
50
|
"proc-macro2",
|
44
51
|
"quote",
|
45
52
|
"regex",
|
@@ -56,9 +63,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
|
56
63
|
|
57
64
|
[[package]]
|
58
65
|
name = "bitflags"
|
59
|
-
version = "2.
|
66
|
+
version = "2.6.0"
|
60
67
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
61
|
-
checksum = "
|
68
|
+
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
|
62
69
|
|
63
70
|
[[package]]
|
64
71
|
name = "block-buffer"
|
@@ -71,9 +78,9 @@ dependencies = [
|
|
71
78
|
|
72
79
|
[[package]]
|
73
80
|
name = "bstr"
|
74
|
-
version = "1.
|
81
|
+
version = "1.10.0"
|
75
82
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
76
|
-
checksum = "
|
83
|
+
checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c"
|
77
84
|
dependencies = [
|
78
85
|
"memchr",
|
79
86
|
"regex-automata",
|
@@ -81,10 +88,10 @@ dependencies = [
|
|
81
88
|
]
|
82
89
|
|
83
90
|
[[package]]
|
84
|
-
name = "
|
85
|
-
version = "1.0
|
91
|
+
name = "byteorder"
|
92
|
+
version = "1.5.0"
|
86
93
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
87
|
-
checksum = "
|
94
|
+
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
88
95
|
|
89
96
|
[[package]]
|
90
97
|
name = "cexpr"
|
@@ -103,9 +110,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|
103
110
|
|
104
111
|
[[package]]
|
105
112
|
name = "clang-sys"
|
106
|
-
version = "1.
|
113
|
+
version = "1.8.1"
|
107
114
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
108
|
-
checksum = "
|
115
|
+
checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
|
109
116
|
dependencies = [
|
110
117
|
"glob",
|
111
118
|
"libc",
|
@@ -114,9 +121,9 @@ dependencies = [
|
|
114
121
|
|
115
122
|
[[package]]
|
116
123
|
name = "cpufeatures"
|
117
|
-
version = "0.2.
|
124
|
+
version = "0.2.14"
|
118
125
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
119
|
-
checksum = "
|
126
|
+
checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0"
|
120
127
|
dependencies = [
|
121
128
|
"libc",
|
122
129
|
]
|
@@ -142,24 +149,19 @@ dependencies = [
|
|
142
149
|
]
|
143
150
|
|
144
151
|
[[package]]
|
145
|
-
name = "
|
146
|
-
version = "
|
152
|
+
name = "either"
|
153
|
+
version = "1.13.0"
|
147
154
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
148
|
-
checksum = "
|
149
|
-
dependencies = [
|
150
|
-
"errno-dragonfly",
|
151
|
-
"libc",
|
152
|
-
"windows-sys",
|
153
|
-
]
|
155
|
+
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
|
154
156
|
|
155
157
|
[[package]]
|
156
|
-
name = "errno
|
157
|
-
version = "0.
|
158
|
+
name = "errno"
|
159
|
+
version = "0.3.9"
|
158
160
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
159
|
-
checksum = "
|
161
|
+
checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
|
160
162
|
dependencies = [
|
161
|
-
"cc",
|
162
163
|
"libc",
|
164
|
+
"windows-sys 0.52.0",
|
163
165
|
]
|
164
166
|
|
165
167
|
[[package]]
|
@@ -175,7 +177,7 @@ dependencies = [
|
|
175
177
|
"nix",
|
176
178
|
"rand",
|
177
179
|
"rb-sys",
|
178
|
-
"rb-sys-env",
|
180
|
+
"rb-sys-env 0.2.1",
|
179
181
|
"serde",
|
180
182
|
"serde_json",
|
181
183
|
"sha2",
|
@@ -186,9 +188,9 @@ dependencies = [
|
|
186
188
|
|
187
189
|
[[package]]
|
188
190
|
name = "fastrand"
|
189
|
-
version = "2.
|
191
|
+
version = "2.1.1"
|
190
192
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
191
|
-
checksum = "
|
193
|
+
checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6"
|
192
194
|
|
193
195
|
[[package]]
|
194
196
|
name = "generic-array"
|
@@ -202,9 +204,9 @@ dependencies = [
|
|
202
204
|
|
203
205
|
[[package]]
|
204
206
|
name = "getrandom"
|
205
|
-
version = "0.2.
|
207
|
+
version = "0.2.15"
|
206
208
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
207
|
-
checksum = "
|
209
|
+
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
|
208
210
|
dependencies = [
|
209
211
|
"cfg-if",
|
210
212
|
"libc",
|
@@ -219,30 +221,40 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
|
|
219
221
|
|
220
222
|
[[package]]
|
221
223
|
name = "hashbrown"
|
222
|
-
version = "0.
|
224
|
+
version = "0.14.5"
|
223
225
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
224
|
-
checksum = "
|
226
|
+
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
225
227
|
dependencies = [
|
226
228
|
"ahash",
|
229
|
+
"allocator-api2",
|
227
230
|
]
|
228
231
|
|
229
232
|
[[package]]
|
230
233
|
name = "indoc"
|
231
|
-
version = "2.0.
|
234
|
+
version = "2.0.5"
|
235
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
236
|
+
checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
|
237
|
+
|
238
|
+
[[package]]
|
239
|
+
name = "itertools"
|
240
|
+
version = "0.12.1"
|
232
241
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
233
|
-
checksum = "
|
242
|
+
checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
|
243
|
+
dependencies = [
|
244
|
+
"either",
|
245
|
+
]
|
234
246
|
|
235
247
|
[[package]]
|
236
248
|
name = "itoa"
|
237
|
-
version = "1.0.
|
249
|
+
version = "1.0.11"
|
238
250
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
239
|
-
checksum = "
|
251
|
+
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
|
240
252
|
|
241
253
|
[[package]]
|
242
254
|
name = "lazy_static"
|
243
|
-
version = "1.
|
255
|
+
version = "1.5.0"
|
244
256
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
245
|
-
checksum = "
|
257
|
+
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
246
258
|
|
247
259
|
[[package]]
|
248
260
|
name = "lazycell"
|
@@ -252,35 +264,35 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
|
252
264
|
|
253
265
|
[[package]]
|
254
266
|
name = "libc"
|
255
|
-
version = "0.2.
|
267
|
+
version = "0.2.159"
|
256
268
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
257
|
-
checksum = "
|
269
|
+
checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
|
258
270
|
|
259
271
|
[[package]]
|
260
272
|
name = "libloading"
|
261
|
-
version = "0.
|
273
|
+
version = "0.8.5"
|
262
274
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
263
|
-
checksum = "
|
275
|
+
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
|
264
276
|
dependencies = [
|
265
277
|
"cfg-if",
|
266
|
-
"
|
278
|
+
"windows-targets",
|
267
279
|
]
|
268
280
|
|
269
281
|
[[package]]
|
270
282
|
name = "linux-raw-sys"
|
271
|
-
version = "0.4.
|
283
|
+
version = "0.4.14"
|
272
284
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
273
|
-
checksum = "
|
285
|
+
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
|
274
286
|
|
275
287
|
[[package]]
|
276
288
|
name = "magnus"
|
277
|
-
version = "0.
|
289
|
+
version = "0.7.1"
|
278
290
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
279
|
-
checksum = "
|
291
|
+
checksum = "3d87ae53030f3a22e83879e666cb94e58a7bdf31706878a0ba48752994146dab"
|
280
292
|
dependencies = [
|
281
293
|
"magnus-macros",
|
282
294
|
"rb-sys",
|
283
|
-
"rb-sys-env",
|
295
|
+
"rb-sys-env 0.1.2",
|
284
296
|
"seq-macro",
|
285
297
|
]
|
286
298
|
|
@@ -297,15 +309,15 @@ dependencies = [
|
|
297
309
|
|
298
310
|
[[package]]
|
299
311
|
name = "memchr"
|
300
|
-
version = "2.
|
312
|
+
version = "2.7.4"
|
301
313
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
302
|
-
checksum = "
|
314
|
+
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
303
315
|
|
304
316
|
[[package]]
|
305
317
|
name = "memmap2"
|
306
|
-
version = "0.5
|
318
|
+
version = "0.9.5"
|
307
319
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
308
|
-
checksum = "
|
320
|
+
checksum = "fd3f7eed9d3848f8b98834af67102b720745c4ec028fcd0aa0239277e7de374f"
|
309
321
|
dependencies = [
|
310
322
|
"libc",
|
311
323
|
]
|
@@ -351,15 +363,12 @@ dependencies = [
|
|
351
363
|
|
352
364
|
[[package]]
|
353
365
|
name = "once_cell"
|
354
|
-
version = "1.
|
355
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
356
|
-
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
|
357
|
-
|
358
|
-
[[package]]
|
359
|
-
name = "peeking_take_while"
|
360
|
-
version = "0.1.2"
|
366
|
+
version = "1.20.1"
|
361
367
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
362
|
-
checksum = "
|
368
|
+
checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1"
|
369
|
+
dependencies = [
|
370
|
+
"portable-atomic",
|
371
|
+
]
|
363
372
|
|
364
373
|
[[package]]
|
365
374
|
name = "pin-utils"
|
@@ -367,26 +376,35 @@ version = "0.1.0"
|
|
367
376
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
368
377
|
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
369
378
|
|
379
|
+
[[package]]
|
380
|
+
name = "portable-atomic"
|
381
|
+
version = "1.9.0"
|
382
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
383
|
+
checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2"
|
384
|
+
|
370
385
|
[[package]]
|
371
386
|
name = "ppv-lite86"
|
372
|
-
version = "0.2.
|
387
|
+
version = "0.2.20"
|
373
388
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
374
|
-
checksum = "
|
389
|
+
checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
|
390
|
+
dependencies = [
|
391
|
+
"zerocopy",
|
392
|
+
]
|
375
393
|
|
376
394
|
[[package]]
|
377
395
|
name = "proc-macro2"
|
378
|
-
version = "1.0.
|
396
|
+
version = "1.0.86"
|
379
397
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
380
|
-
checksum = "
|
398
|
+
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
|
381
399
|
dependencies = [
|
382
400
|
"unicode-ident",
|
383
401
|
]
|
384
402
|
|
385
403
|
[[package]]
|
386
404
|
name = "quote"
|
387
|
-
version = "1.0.
|
405
|
+
version = "1.0.37"
|
388
406
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
389
|
-
checksum = "
|
407
|
+
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
|
390
408
|
dependencies = [
|
391
409
|
"proc-macro2",
|
392
410
|
]
|
@@ -423,18 +441,18 @@ dependencies = [
|
|
423
441
|
|
424
442
|
[[package]]
|
425
443
|
name = "rb-sys"
|
426
|
-
version = "0.9.
|
444
|
+
version = "0.9.105"
|
427
445
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
428
|
-
checksum = "
|
446
|
+
checksum = "4b3a1f3ce8e7c36d777d52fe7a99039fe4fea7c8ec355a4c4f3a17f92a14029f"
|
429
447
|
dependencies = [
|
430
448
|
"rb-sys-build",
|
431
449
|
]
|
432
450
|
|
433
451
|
[[package]]
|
434
452
|
name = "rb-sys-build"
|
435
|
-
version = "0.9.
|
453
|
+
version = "0.9.105"
|
436
454
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
437
|
-
checksum = "
|
455
|
+
checksum = "3e6b246c29c0809e1cbe60a1ba9e093da72a4676d02adc68469297d1e589bbf0"
|
438
456
|
dependencies = [
|
439
457
|
"bindgen",
|
440
458
|
"lazy_static",
|
@@ -452,36 +470,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
452
470
|
checksum = "a35802679f07360454b418a5d1735c89716bde01d35b1560fc953c1415a0b3bb"
|
453
471
|
|
454
472
|
[[package]]
|
455
|
-
name = "
|
456
|
-
version = "0.
|
473
|
+
name = "rb-sys-env"
|
474
|
+
version = "0.2.1"
|
457
475
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
458
|
-
checksum = "
|
459
|
-
dependencies = [
|
460
|
-
"bitflags 1.3.2",
|
461
|
-
]
|
476
|
+
checksum = "5b0412803f8fea126e8f500d8eb6d5394a983517888a790254f4190e9b16a7a5"
|
462
477
|
|
463
478
|
[[package]]
|
464
479
|
name = "regex"
|
465
|
-
version = "1.
|
480
|
+
version = "1.11.0"
|
466
481
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
467
|
-
checksum = "
|
482
|
+
checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8"
|
468
483
|
dependencies = [
|
469
484
|
"aho-corasick",
|
470
485
|
"memchr",
|
486
|
+
"regex-automata",
|
471
487
|
"regex-syntax",
|
472
488
|
]
|
473
489
|
|
474
490
|
[[package]]
|
475
491
|
name = "regex-automata"
|
476
|
-
version = "0.
|
492
|
+
version = "0.4.8"
|
477
493
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
478
|
-
checksum = "
|
494
|
+
checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3"
|
495
|
+
dependencies = [
|
496
|
+
"aho-corasick",
|
497
|
+
"memchr",
|
498
|
+
"regex-syntax",
|
499
|
+
]
|
479
500
|
|
480
501
|
[[package]]
|
481
502
|
name = "regex-syntax"
|
482
|
-
version = "0.
|
503
|
+
version = "0.8.5"
|
483
504
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
484
|
-
checksum = "
|
505
|
+
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
485
506
|
|
486
507
|
[[package]]
|
487
508
|
name = "rustc-hash"
|
@@ -491,43 +512,43 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
|
491
512
|
|
492
513
|
[[package]]
|
493
514
|
name = "rustix"
|
494
|
-
version = "0.38.
|
515
|
+
version = "0.38.37"
|
495
516
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
496
|
-
checksum = "
|
517
|
+
checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811"
|
497
518
|
dependencies = [
|
498
|
-
"bitflags 2.
|
519
|
+
"bitflags 2.6.0",
|
499
520
|
"errno",
|
500
521
|
"libc",
|
501
522
|
"linux-raw-sys",
|
502
|
-
"windows-sys",
|
523
|
+
"windows-sys 0.52.0",
|
503
524
|
]
|
504
525
|
|
505
526
|
[[package]]
|
506
527
|
name = "ryu"
|
507
|
-
version = "1.0.
|
528
|
+
version = "1.0.18"
|
508
529
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
509
|
-
checksum = "
|
530
|
+
checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
|
510
531
|
|
511
532
|
[[package]]
|
512
533
|
name = "seq-macro"
|
513
|
-
version = "0.3.
|
534
|
+
version = "0.3.5"
|
514
535
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
515
|
-
checksum = "
|
536
|
+
checksum = "a3f0bf26fd526d2a95683cd0f87bf103b8539e2ca1ef48ce002d67aad59aa0b4"
|
516
537
|
|
517
538
|
[[package]]
|
518
539
|
name = "serde"
|
519
|
-
version = "1.0.
|
540
|
+
version = "1.0.210"
|
520
541
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
521
|
-
checksum = "
|
542
|
+
checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a"
|
522
543
|
dependencies = [
|
523
544
|
"serde_derive",
|
524
545
|
]
|
525
546
|
|
526
547
|
[[package]]
|
527
548
|
name = "serde_derive"
|
528
|
-
version = "1.0.
|
549
|
+
version = "1.0.210"
|
529
550
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
530
|
-
checksum = "
|
551
|
+
checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
|
531
552
|
dependencies = [
|
532
553
|
"proc-macro2",
|
533
554
|
"quote",
|
@@ -536,20 +557,21 @@ dependencies = [
|
|
536
557
|
|
537
558
|
[[package]]
|
538
559
|
name = "serde_json"
|
539
|
-
version = "1.0.
|
560
|
+
version = "1.0.128"
|
540
561
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
541
|
-
checksum = "
|
562
|
+
checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8"
|
542
563
|
dependencies = [
|
543
564
|
"itoa",
|
565
|
+
"memchr",
|
544
566
|
"ryu",
|
545
567
|
"serde",
|
546
568
|
]
|
547
569
|
|
548
570
|
[[package]]
|
549
571
|
name = "sha2"
|
550
|
-
version = "0.10.
|
572
|
+
version = "0.10.8"
|
551
573
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
552
|
-
checksum = "
|
574
|
+
checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
|
553
575
|
dependencies = [
|
554
576
|
"cfg-if",
|
555
577
|
"cpufeatures",
|
@@ -564,24 +586,24 @@ checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
|
|
564
586
|
|
565
587
|
[[package]]
|
566
588
|
name = "shlex"
|
567
|
-
version = "1.
|
589
|
+
version = "1.3.0"
|
568
590
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
569
|
-
checksum = "
|
591
|
+
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
570
592
|
|
571
593
|
[[package]]
|
572
594
|
name = "smallvec"
|
573
|
-
version = "1.
|
595
|
+
version = "1.13.2"
|
574
596
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
575
|
-
checksum = "
|
597
|
+
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
|
576
598
|
dependencies = [
|
577
599
|
"serde",
|
578
600
|
]
|
579
601
|
|
580
602
|
[[package]]
|
581
603
|
name = "syn"
|
582
|
-
version = "2.0.
|
604
|
+
version = "2.0.79"
|
583
605
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
584
|
-
checksum = "
|
606
|
+
checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
|
585
607
|
dependencies = [
|
586
608
|
"proc-macro2",
|
587
609
|
"quote",
|
@@ -590,31 +612,31 @@ dependencies = [
|
|
590
612
|
|
591
613
|
[[package]]
|
592
614
|
name = "tempfile"
|
593
|
-
version = "3.
|
615
|
+
version = "3.13.0"
|
594
616
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
595
|
-
checksum = "
|
617
|
+
checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b"
|
596
618
|
dependencies = [
|
597
619
|
"cfg-if",
|
598
620
|
"fastrand",
|
599
|
-
"
|
621
|
+
"once_cell",
|
600
622
|
"rustix",
|
601
|
-
"windows-sys",
|
623
|
+
"windows-sys 0.59.0",
|
602
624
|
]
|
603
625
|
|
604
626
|
[[package]]
|
605
627
|
name = "thiserror"
|
606
|
-
version = "1.0.
|
628
|
+
version = "1.0.64"
|
607
629
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
608
|
-
checksum = "
|
630
|
+
checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84"
|
609
631
|
dependencies = [
|
610
632
|
"thiserror-impl",
|
611
633
|
]
|
612
634
|
|
613
635
|
[[package]]
|
614
636
|
name = "thiserror-impl"
|
615
|
-
version = "1.0.
|
637
|
+
version = "1.0.64"
|
616
638
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
617
|
-
checksum = "
|
639
|
+
checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
|
618
640
|
dependencies = [
|
619
641
|
"proc-macro2",
|
620
642
|
"quote",
|
@@ -623,21 +645,21 @@ dependencies = [
|
|
623
645
|
|
624
646
|
[[package]]
|
625
647
|
name = "typenum"
|
626
|
-
version = "1.
|
648
|
+
version = "1.17.0"
|
627
649
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
628
|
-
checksum = "
|
650
|
+
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
|
629
651
|
|
630
652
|
[[package]]
|
631
653
|
name = "unicode-ident"
|
632
|
-
version = "1.0.
|
654
|
+
version = "1.0.13"
|
633
655
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
634
|
-
checksum = "
|
656
|
+
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
|
635
657
|
|
636
658
|
[[package]]
|
637
659
|
name = "version_check"
|
638
|
-
version = "0.9.
|
660
|
+
version = "0.9.5"
|
639
661
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
640
|
-
checksum = "
|
662
|
+
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
641
663
|
|
642
664
|
[[package]]
|
643
665
|
name = "wasi"
|
@@ -646,45 +668,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
646
668
|
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
647
669
|
|
648
670
|
[[package]]
|
649
|
-
name = "
|
650
|
-
version = "0.
|
671
|
+
name = "windows-sys"
|
672
|
+
version = "0.52.0"
|
651
673
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
652
|
-
checksum = "
|
674
|
+
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
653
675
|
dependencies = [
|
654
|
-
"
|
655
|
-
"winapi-x86_64-pc-windows-gnu",
|
676
|
+
"windows-targets",
|
656
677
|
]
|
657
678
|
|
658
|
-
[[package]]
|
659
|
-
name = "winapi-i686-pc-windows-gnu"
|
660
|
-
version = "0.4.0"
|
661
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
662
|
-
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
663
|
-
|
664
|
-
[[package]]
|
665
|
-
name = "winapi-x86_64-pc-windows-gnu"
|
666
|
-
version = "0.4.0"
|
667
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
668
|
-
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
669
|
-
|
670
679
|
[[package]]
|
671
680
|
name = "windows-sys"
|
672
|
-
version = "0.
|
681
|
+
version = "0.59.0"
|
673
682
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
674
|
-
checksum = "
|
683
|
+
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
675
684
|
dependencies = [
|
676
685
|
"windows-targets",
|
677
686
|
]
|
678
687
|
|
679
688
|
[[package]]
|
680
689
|
name = "windows-targets"
|
681
|
-
version = "0.
|
690
|
+
version = "0.52.6"
|
682
691
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
683
|
-
checksum = "
|
692
|
+
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
684
693
|
dependencies = [
|
685
694
|
"windows_aarch64_gnullvm",
|
686
695
|
"windows_aarch64_msvc",
|
687
696
|
"windows_i686_gnu",
|
697
|
+
"windows_i686_gnullvm",
|
688
698
|
"windows_i686_msvc",
|
689
699
|
"windows_x86_64_gnu",
|
690
700
|
"windows_x86_64_gnullvm",
|
@@ -693,42 +703,69 @@ dependencies = [
|
|
693
703
|
|
694
704
|
[[package]]
|
695
705
|
name = "windows_aarch64_gnullvm"
|
696
|
-
version = "0.
|
706
|
+
version = "0.52.6"
|
697
707
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
698
|
-
checksum = "
|
708
|
+
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
699
709
|
|
700
710
|
[[package]]
|
701
711
|
name = "windows_aarch64_msvc"
|
702
|
-
version = "0.
|
712
|
+
version = "0.52.6"
|
703
713
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
704
|
-
checksum = "
|
714
|
+
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
705
715
|
|
706
716
|
[[package]]
|
707
717
|
name = "windows_i686_gnu"
|
708
|
-
version = "0.
|
718
|
+
version = "0.52.6"
|
719
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
720
|
+
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
721
|
+
|
722
|
+
[[package]]
|
723
|
+
name = "windows_i686_gnullvm"
|
724
|
+
version = "0.52.6"
|
709
725
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
710
|
-
checksum = "
|
726
|
+
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
711
727
|
|
712
728
|
[[package]]
|
713
729
|
name = "windows_i686_msvc"
|
714
|
-
version = "0.
|
730
|
+
version = "0.52.6"
|
715
731
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
716
|
-
checksum = "
|
732
|
+
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
717
733
|
|
718
734
|
[[package]]
|
719
735
|
name = "windows_x86_64_gnu"
|
720
|
-
version = "0.
|
736
|
+
version = "0.52.6"
|
721
737
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
722
|
-
checksum = "
|
738
|
+
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
723
739
|
|
724
740
|
[[package]]
|
725
741
|
name = "windows_x86_64_gnullvm"
|
726
|
-
version = "0.
|
742
|
+
version = "0.52.6"
|
727
743
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
728
|
-
checksum = "
|
744
|
+
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
729
745
|
|
730
746
|
[[package]]
|
731
747
|
name = "windows_x86_64_msvc"
|
732
|
-
version = "0.
|
748
|
+
version = "0.52.6"
|
749
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
750
|
+
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
751
|
+
|
752
|
+
[[package]]
|
753
|
+
name = "zerocopy"
|
754
|
+
version = "0.7.35"
|
733
755
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
734
|
-
checksum = "
|
756
|
+
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
|
757
|
+
dependencies = [
|
758
|
+
"byteorder",
|
759
|
+
"zerocopy-derive",
|
760
|
+
]
|
761
|
+
|
762
|
+
[[package]]
|
763
|
+
name = "zerocopy-derive"
|
764
|
+
version = "0.7.35"
|
765
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
766
|
+
checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
|
767
|
+
dependencies = [
|
768
|
+
"proc-macro2",
|
769
|
+
"quote",
|
770
|
+
"syn",
|
771
|
+
]
|
@@ -6,29 +6,29 @@ edition = "2021"
|
|
6
6
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
7
7
|
|
8
8
|
[dependencies]
|
9
|
-
hashbrown = "0.
|
9
|
+
hashbrown = "0.14"
|
10
10
|
libc = "0.2"
|
11
|
-
magnus = { version = "0.
|
12
|
-
memmap2 = "0.
|
11
|
+
magnus = { version = "0.7", features = ["rb-sys"] }
|
12
|
+
memmap2 = "0.9"
|
13
13
|
# v0.26 cannot be built on CentOS 7 https://github.com/nix-rust/nix/issues/1972
|
14
14
|
nix = { version = "0.25", features = ["mman"] } # mman used for MsFlags
|
15
|
-
rb-sys = "0.9.
|
15
|
+
rb-sys = { version = "0.9.105", features = ["stable-api-compiled-fallback"] }
|
16
16
|
serde = { version = "1.0", features = ["derive"] }
|
17
17
|
serde_json = { version = "1.0", features = ["raw_value"] }
|
18
18
|
smallvec = { version = "1.10", features = ["serde"] }
|
19
19
|
thiserror = "1.0"
|
20
20
|
|
21
21
|
[dev-dependencies]
|
22
|
-
bstr = "1.
|
22
|
+
bstr = "1.9"
|
23
23
|
indoc = "2.0"
|
24
24
|
# We need the `embed` feature to run tests, but this triggers failures when building as a Gem.
|
25
|
-
magnus = { version = "0.
|
25
|
+
magnus = { version = "0.7", features = ["rb-sys","embed"] }
|
26
26
|
rand = "0.8"
|
27
27
|
sha2 = "0.10"
|
28
|
-
tempfile = "3.
|
28
|
+
tempfile = "3.9"
|
29
29
|
|
30
30
|
[build-dependencies]
|
31
|
-
rb-sys-env = "0.1"
|
31
|
+
rb-sys-env = "0.2.1"
|
32
32
|
|
33
33
|
[lib]
|
34
34
|
# Integration tests won't work if crate is only `cdylib`.
|
@@ -100,13 +100,6 @@ pub enum MmapError {
|
|
100
100
|
/// No mmap open.
|
101
101
|
#[error("unmapped file")]
|
102
102
|
UnmappedFile,
|
103
|
-
/// File length changed by another process.
|
104
|
-
#[error("size of {path} {len} does not match previous size {expected_len}. Another process may have modified it.")]
|
105
|
-
UnexpectedFileLength {
|
106
|
-
path: String,
|
107
|
-
len: usize,
|
108
|
-
expected_len: usize,
|
109
|
-
},
|
110
103
|
/// A custom error message with `strerror(3)` appended.
|
111
104
|
#[error("{0}")]
|
112
105
|
WithErrno(String),
|
@@ -169,7 +162,6 @@ impl MmapError {
|
|
169
162
|
MmapError::Other(_) => RubyError::Arg,
|
170
163
|
MmapError::PromParsing(_) => RubyError::PromParsing,
|
171
164
|
MmapError::UnmappedFile => RubyError::Io,
|
172
|
-
MmapError::UnexpectedFileLength { .. } => RubyError::Runtime,
|
173
165
|
MmapError::WithErrno(_) => RubyError::Io,
|
174
166
|
}
|
175
167
|
}
|
@@ -5,7 +5,7 @@ use std::fs::File;
|
|
5
5
|
use std::mem::size_of;
|
6
6
|
use std::ops::Range;
|
7
7
|
use std::os::unix::prelude::{AsRawFd, RawFd};
|
8
|
-
use std::path::
|
8
|
+
use std::path::PathBuf;
|
9
9
|
|
10
10
|
use crate::error::{MmapError, RubyError};
|
11
11
|
use crate::raw_entry::RawEntry;
|
@@ -34,8 +34,6 @@ pub(super) struct InnerMmap {
|
|
34
34
|
///
|
35
35
|
/// Equivalent to `i_mm->t->real` in the C implementation.
|
36
36
|
len: usize,
|
37
|
-
/// The length of the file being mmapped at the time of mapping.
|
38
|
-
file_len: usize,
|
39
37
|
}
|
40
38
|
|
41
39
|
impl InnerMmap {
|
@@ -43,12 +41,19 @@ impl InnerMmap {
|
|
43
41
|
/// Use when mmapping a file for the first time. When re-mapping a file
|
44
42
|
/// after expanding it the `reestablish` function should be used.
|
45
43
|
pub fn new(path: PathBuf, file: File) -> Result<Self> {
|
46
|
-
let
|
44
|
+
let stat = file.metadata().map_err(|e| {
|
45
|
+
MmapError::legacy(
|
46
|
+
format!("Can't stat {}: {e}", path.display()),
|
47
|
+
RubyError::Arg,
|
48
|
+
)
|
49
|
+
})?;
|
50
|
+
|
51
|
+
let file_size = util::cast_chk::<_, usize>(stat.len(), "file length")?;
|
47
52
|
|
48
53
|
// We need to ensure the underlying file descriptor is at least a page size.
|
49
54
|
// Otherwise, we could get a SIGBUS error if mmap() attempts to read or write
|
50
55
|
// past the file.
|
51
|
-
let reserve_size = Self::next_page_boundary(
|
56
|
+
let reserve_size = Self::next_page_boundary(file_size)?;
|
52
57
|
|
53
58
|
// Cast: no-op.
|
54
59
|
Self::reserve_mmap_file_bytes(file.as_raw_fd(), reserve_size as off_t).map_err(|e| {
|
@@ -62,23 +67,21 @@ impl InnerMmap {
|
|
62
67
|
})?;
|
63
68
|
|
64
69
|
// Ensure we always have space for the header.
|
65
|
-
let map_len =
|
70
|
+
let map_len = file_size.max(HEADER_SIZE);
|
66
71
|
|
67
72
|
// SAFETY: There is the possibility of UB if the file is modified outside of
|
68
73
|
// this program.
|
69
74
|
let map = unsafe { MmapOptions::new().len(map_len).map_mut(&file) }.map_err(|e| {
|
70
75
|
MmapError::legacy(format!("mmap failed ({}): {e}", errno()), RubyError::Arg)
|
71
76
|
})?;
|
72
|
-
let file_len = util::cast_chk::<_, usize>(reserve_size, "file length")?;
|
73
77
|
|
74
|
-
let len =
|
78
|
+
let len = file_size;
|
75
79
|
|
76
80
|
Ok(Self {
|
77
81
|
file,
|
78
82
|
path,
|
79
83
|
map,
|
80
84
|
len,
|
81
|
-
file_len,
|
82
85
|
})
|
83
86
|
}
|
84
87
|
|
@@ -94,14 +97,12 @@ impl InnerMmap {
|
|
94
97
|
// to the old length at this point if closing the file. Matching C implementation
|
95
98
|
// for now.
|
96
99
|
let len = map_len;
|
97
|
-
let file_len = get_file_len(&path, &file)?;
|
98
100
|
|
99
101
|
Ok(Self {
|
100
102
|
file,
|
101
103
|
path,
|
102
104
|
map,
|
103
105
|
len,
|
104
|
-
file_len,
|
105
106
|
})
|
106
107
|
}
|
107
108
|
|
@@ -185,7 +186,7 @@ impl InnerMmap {
|
|
185
186
|
self.len
|
186
187
|
}
|
187
188
|
|
188
|
-
/// The total length in bytes of the mmapped
|
189
|
+
/// The total length in bytes of the mmapped file.
|
189
190
|
///
|
190
191
|
/// Equivalent to `i_mm->t->len` in the C implementation.
|
191
192
|
#[inline]
|
@@ -193,21 +194,6 @@ impl InnerMmap {
|
|
193
194
|
self.map.len()
|
194
195
|
}
|
195
196
|
|
196
|
-
/// `stat` the mmapped file and return its length.
|
197
|
-
pub fn check_file_len(&self) -> Result<usize> {
|
198
|
-
get_file_len(&self.path, &self.file)
|
199
|
-
}
|
200
|
-
|
201
|
-
/// The length of the file at the time it was mmapped.
|
202
|
-
pub fn file_len(&self) -> usize {
|
203
|
-
self.file_len
|
204
|
-
}
|
205
|
-
|
206
|
-
/// The path of the mmapped file.
|
207
|
-
pub fn path(&self) -> String {
|
208
|
-
self.path.to_string_lossy().to_string()
|
209
|
-
}
|
210
|
-
|
211
197
|
/// Update the length of the mmap considered to be written.
|
212
198
|
pub fn set_len(&mut self, len: usize) {
|
213
199
|
self.len = len;
|
@@ -326,17 +312,6 @@ impl InnerMmap {
|
|
326
312
|
}
|
327
313
|
}
|
328
314
|
|
329
|
-
fn get_file_len(path: &Path, file: &File) -> Result<usize> {
|
330
|
-
let stat = file.metadata().map_err(|e| {
|
331
|
-
MmapError::legacy(
|
332
|
-
format!("Can't stat {}: {e}", path.display()),
|
333
|
-
RubyError::Arg,
|
334
|
-
)
|
335
|
-
})?;
|
336
|
-
|
337
|
-
util::cast_chk::<_, usize>(stat.len(), "file length")
|
338
|
-
}
|
339
|
-
|
340
315
|
#[cfg(test)]
|
341
316
|
mod test {
|
342
317
|
use nix::unistd::{self, SysconfVar};
|
@@ -25,11 +25,18 @@ use inner::InnerMmap;
|
|
25
25
|
|
26
26
|
mod inner;
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
#[cfg(ruby_gt_3_3)]
|
29
|
+
/// The Ruby `STR_SHARED` flag, aka `FL_USER0`.
|
30
|
+
/// This was changed from `FL_USER2` in https://github.com/ruby/ruby/commit/6deeec5d459ecff5ec4628523b14ac7379fd942e.
|
31
|
+
const STR_SHARED: c_ulong = 1 << (12);
|
32
|
+
|
33
|
+
#[cfg(ruby_lte_3_3)]
|
30
34
|
/// The Ruby `STR_SHARED` flag, aka `FL_USER2`.
|
31
35
|
const STR_SHARED: c_ulong = 1 << (14);
|
32
36
|
|
37
|
+
/// The Ruby `STR_NOEMBED` flag, aka `FL_USER1`.
|
38
|
+
const STR_NOEMBED: c_ulong = 1 << (13);
|
39
|
+
|
33
40
|
/// A Rust struct wrapped in a Ruby object, providing access to a memory-mapped
|
34
41
|
/// file used to store, update, and read out Prometheus metrics.
|
35
42
|
///
|
@@ -390,8 +397,10 @@ impl MmapedFile {
|
|
390
397
|
let new_len = self.inner(|inner| util::cast_chk::<_, c_long>(inner.len(), "mmap len"))?;
|
391
398
|
|
392
399
|
// Iterate over the values of the `WeakMap`.
|
393
|
-
for
|
394
|
-
let
|
400
|
+
for pair in tracker.enumeratorize("each_pair", ()) {
|
401
|
+
let rpair = magnus::RArray::try_convert(pair?)?;
|
402
|
+
let rb_string: Value = rpair.entry(1)?;
|
403
|
+
|
395
404
|
let str = RString::from_value(rb_string)
|
396
405
|
.ok_or_else(|| err!(arg_error(), "weakmap value was not a string"))?;
|
397
406
|
|
@@ -441,49 +450,17 @@ impl MmapedFile {
|
|
441
450
|
}
|
442
451
|
|
443
452
|
/// Check that the mmap is large enough to contain the value to be added,
|
444
|
-
/// and expand it to fit if necessary.
|
445
|
-
/// has been resized by another process.
|
453
|
+
/// and expand it to fit if necessary.
|
446
454
|
fn check_expand(&self, rb_self: Obj<Self>, key_len: usize) -> magnus::error::Result<()> {
|
447
455
|
// CAST: no-op on 32-bit, widening on 64-bit.
|
448
456
|
let used = self.inner(|inner| inner.load_used())? as usize;
|
449
457
|
let entry_len = RawEntry::calc_total_len(key_len)?;
|
450
|
-
let required_len = used.add_chk(entry_len)?;
|
451
|
-
let mut target_cap = self.capacity();
|
452
458
|
|
453
|
-
let mut needs_resize = false;
|
454
459
|
// We need the mmapped region to contain at least one byte beyond the
|
455
|
-
// written data to create a NUL-terminated C string. Validate that
|
456
|
-
// new length does not exactly match the length of the mmap.
|
457
|
-
|
458
|
-
|
459
|
-
target_cap = required_len + 1;
|
460
|
-
}
|
461
|
-
|
462
|
-
let (current_file_len, original_file_len) =
|
463
|
-
self.inner(|inner| Ok((inner.check_file_len()?, inner.file_len())))?;
|
464
|
-
|
465
|
-
let file_modified = current_file_len != original_file_len;
|
466
|
-
if file_modified {
|
467
|
-
// Ensure our new capacity is at least as large as the actual file.
|
468
|
-
// Erroring out without first resizing the mmap would leave us stuck
|
469
|
-
// in a bad state.
|
470
|
-
target_cap = current_file_len
|
471
|
-
}
|
472
|
-
|
473
|
-
if needs_resize {
|
474
|
-
self.expand_to_fit(rb_self, target_cap)?;
|
475
|
-
}
|
476
|
-
|
477
|
-
if file_modified {
|
478
|
-
// Return an error so the caller is alerted that there were concurrent writes to the
|
479
|
-
// file.
|
480
|
-
let path = self.inner(|inner| Ok(inner.path()))?;
|
481
|
-
return Err(MmapError::UnexpectedFileLength {
|
482
|
-
path,
|
483
|
-
len: current_file_len,
|
484
|
-
expected_len: original_file_len,
|
485
|
-
}
|
486
|
-
.into());
|
460
|
+
// written data to create a NUL- terminated C string. Validate that
|
461
|
+
// new length does not exactly match or exceed the length of the mmap.
|
462
|
+
while self.capacity() <= used.add_chk(entry_len)? {
|
463
|
+
self.expand_to_fit(rb_self, self.capacity().mul_chk(2)?)?;
|
487
464
|
}
|
488
465
|
|
489
466
|
Ok(())
|
@@ -684,7 +661,6 @@ mod test {
|
|
684
661
|
use super::*;
|
685
662
|
use crate::raw_entry::RawEntry;
|
686
663
|
use crate::testhelper::TestFile;
|
687
|
-
use std::os::unix::prelude::AsRawFd;
|
688
664
|
|
689
665
|
/// Create a wrapped MmapedFile object.
|
690
666
|
fn create_obj() -> Obj<MmapedFile> {
|
@@ -914,37 +890,4 @@ mod test {
|
|
914
890
|
// Validate that we have expanded the mmap, ensuring a trailing NUL.
|
915
891
|
assert!(rs_self.capacity() > current_cap);
|
916
892
|
}
|
917
|
-
|
918
|
-
#[test]
|
919
|
-
fn test_detect_external_resize() {
|
920
|
-
let _cleanup = unsafe { magnus::embed::init() };
|
921
|
-
let ruby = magnus::Ruby::get().unwrap();
|
922
|
-
crate::init(&ruby).unwrap();
|
923
|
-
|
924
|
-
let TestFile {
|
925
|
-
file,
|
926
|
-
path,
|
927
|
-
dir: _dir,
|
928
|
-
} = TestFile::new(&[0u8; 8]);
|
929
|
-
|
930
|
-
let path_str = path.display().to_string();
|
931
|
-
let rpath = RString::new(&path_str);
|
932
|
-
|
933
|
-
// Object created successfully
|
934
|
-
let result: std::result::Result<Obj<MmapedFile>, Error> =
|
935
|
-
eval!("FastMmapedFileRs.new(path)", path = rpath);
|
936
|
-
assert!(result.is_ok());
|
937
|
-
let obj = result.unwrap();
|
938
|
-
|
939
|
-
let rs_self = &*obj;
|
940
|
-
|
941
|
-
let file_len = 1 << 32;
|
942
|
-
nix::unistd::ftruncate(file.as_raw_fd(), file_len).unwrap();
|
943
|
-
|
944
|
-
// We error when the file is externally modified.
|
945
|
-
assert!(rs_self.check_expand(obj, 512).is_err());
|
946
|
-
|
947
|
-
// We updated the object to use the new size.
|
948
|
-
assert_eq!(rs_self.capacity(), file_len as usize);
|
949
|
-
}
|
950
893
|
}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prometheus-client-mmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: x86_64-linux
|
6
6
|
authors:
|
7
7
|
- Tobias Schmidt
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2024-
|
14
|
+
date: 2024-12-31 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rb_sys
|
@@ -27,6 +27,20 @@ dependencies:
|
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 0.9.86
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: base64
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
30
44
|
- !ruby/object:Gem::Dependency
|
31
45
|
name: fuzzbert
|
32
46
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,14 +123,14 @@ dependencies:
|
|
109
123
|
requirements:
|
110
124
|
- - "~>"
|
111
125
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
126
|
+
version: '1.6'
|
113
127
|
type: :development
|
114
128
|
prerelease: false
|
115
129
|
version_requirements: !ruby/object:Gem::Requirement
|
116
130
|
requirements:
|
117
131
|
- - "~>"
|
118
132
|
- !ruby/object:Gem::Version
|
119
|
-
version:
|
133
|
+
version: '1.6'
|
120
134
|
description:
|
121
135
|
email:
|
122
136
|
- ts@soundcloud.com
|
@@ -150,7 +164,6 @@ files:
|
|
150
164
|
- lib/3.0/fast_mmaped_file_rs.so
|
151
165
|
- lib/3.1/fast_mmaped_file_rs.so
|
152
166
|
- lib/3.2/fast_mmaped_file_rs.so
|
153
|
-
- lib/3.3/fast_mmaped_file_rs.so
|
154
167
|
- lib/prometheus.rb
|
155
168
|
- lib/prometheus/client.rb
|
156
169
|
- lib/prometheus/client/configuration.rb
|
@@ -195,14 +208,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
195
208
|
version: '2.7'
|
196
209
|
- - "<"
|
197
210
|
- !ruby/object:Gem::Version
|
198
|
-
version: 3.
|
211
|
+
version: 3.3.dev
|
199
212
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
200
213
|
requirements:
|
201
214
|
- - ">="
|
202
215
|
- !ruby/object:Gem::Version
|
203
216
|
version: '0'
|
204
217
|
requirements: []
|
205
|
-
rubygems_version: 3.
|
218
|
+
rubygems_version: 3.5.23
|
206
219
|
signing_key:
|
207
220
|
specification_version: 4
|
208
221
|
summary: A suite of instrumentation metric primitives that can be exposed through
|
Binary file
|