prometheus-client-mmap 0.24.5-x86_64-linux → 0.25.0-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/mmap.c +13 -2
- data/ext/fast_mmaped_file_rs/Cargo.lock +10 -8
- data/ext/fast_mmaped_file_rs/Cargo.toml +3 -0
- data/ext/fast_mmaped_file_rs/build.rs +5 -0
- data/ext/fast_mmaped_file_rs/src/mmap.rs +15 -6
- data/lib/2.7/fast_mmaped_file.so +0 -0
- data/lib/2.7/fast_mmaped_file_rs.so +0 -0
- data/lib/3.0/fast_mmaped_file.so +0 -0
- data/lib/3.0/fast_mmaped_file_rs.so +0 -0
- data/lib/3.1/fast_mmaped_file.so +0 -0
- data/lib/3.1/fast_mmaped_file_rs.so +0 -0
- data/lib/3.2/fast_mmaped_file.so +0 -0
- data/lib/3.2/fast_mmaped_file_rs.so +0 -0
- data/lib/prometheus/client/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8392f2d676133039741efc162c8365a692a8dd3ce2d584af4a97f40ed39981db
|
4
|
+
data.tar.gz: '01139643ee538a1c765f86cc54c2ab36a72282d6484378ba713041f30385ece8'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bace69a5e6398cc35ee32aad8b0ca99229e6e5313b6a9bb4f54aa767c24ddef2780c89759ce17586732c82d456782a53818dae8d9cf459962c894324f690b3e
|
7
|
+
data.tar.gz: 6b13dc1cad92df550e802addaceec0891d720ee602b1083cc8e82cd35523b3ca74614c171fe13300992b342fba67bc16374718629a794246031f76a6cf0f7ce3
|
data/ext/fast_mmaped_file/mmap.c
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
#include <errno.h>
|
4
4
|
#include <fcntl.h>
|
5
5
|
#include <ruby/util.h>
|
6
|
+
#include <ruby/version.h>
|
6
7
|
#include <sys/mman.h>
|
7
8
|
|
8
9
|
#include "file_format.h"
|
@@ -27,6 +28,16 @@
|
|
27
28
|
*/
|
28
29
|
static VALUE weak_obj_tracker_get_key(VALUE val) { return val; }
|
29
30
|
|
31
|
+
static void update_rstring_len(VALUE val, size_t len) {
|
32
|
+
#if defined(RUBY_API_VERSION_MAJOR) && defined(RUBY_API_VERSION_MINOR) && (RUBY_API_VERSION_MAJOR == 3) && \
|
33
|
+
(RUBY_API_VERSION_MINOR >= 3)
|
34
|
+
|
35
|
+
RSTRING(val)->len = len;
|
36
|
+
#else
|
37
|
+
RSTRING(val)->as.heap.len = len;
|
38
|
+
#endif
|
39
|
+
}
|
40
|
+
|
30
41
|
/**
|
31
42
|
* Adds a T_STRING type to the WeakMap. The WeakMap should be stored
|
32
43
|
* as an instance variable.
|
@@ -52,7 +63,7 @@ VALUE mm_update_obj_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, self)) {
|
|
52
63
|
GET_MMAP(self, i_mm, MM_MODIFY);
|
53
64
|
|
54
65
|
RSTRING(i)->as.heap.ptr = i_mm->t->addr;
|
55
|
-
|
66
|
+
update_rstring_len(i, i_mm->t->real);
|
56
67
|
|
57
68
|
return Qtrue;
|
58
69
|
}
|
@@ -98,7 +109,7 @@ static VALUE mm_str(VALUE obj, int modify) {
|
|
98
109
|
ret = rb_obj_alloc(rb_cString);
|
99
110
|
RSTRING(ret)->as.heap.ptr = i_mm->t->addr;
|
100
111
|
RSTRING(ret)->as.heap.aux.capa = i_mm->t->len;
|
101
|
-
|
112
|
+
update_rstring_len(ret, i_mm->t->real);
|
102
113
|
|
103
114
|
weak_obj_tracker_add(obj, ret);
|
104
115
|
|
@@ -30,9 +30,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
|
30
30
|
|
31
31
|
[[package]]
|
32
32
|
name = "bindgen"
|
33
|
-
version = "0.
|
33
|
+
version = "0.62.0"
|
34
34
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
35
|
-
checksum = "
|
35
|
+
checksum = "c6720a8b7b2d39dd533285ed438d458f65b31b5c257e6ac7bb3d7e82844dd722"
|
36
36
|
dependencies = [
|
37
37
|
"bitflags",
|
38
38
|
"cexpr",
|
@@ -45,6 +45,7 @@ dependencies = [
|
|
45
45
|
"regex",
|
46
46
|
"rustc-hash",
|
47
47
|
"shlex",
|
48
|
+
"syn 1.0.109",
|
48
49
|
]
|
49
50
|
|
50
51
|
[[package]]
|
@@ -169,6 +170,7 @@ dependencies = [
|
|
169
170
|
"nix",
|
170
171
|
"rand",
|
171
172
|
"rb-sys",
|
173
|
+
"rb-sys-env",
|
172
174
|
"serde",
|
173
175
|
"serde_json",
|
174
176
|
"sha2",
|
@@ -297,7 +299,7 @@ checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f"
|
|
297
299
|
[[package]]
|
298
300
|
name = "magnus"
|
299
301
|
version = "0.5.0"
|
300
|
-
source = "git+https://github.com/matsadler/magnus?branch=main#
|
302
|
+
source = "git+https://github.com/matsadler/magnus?branch=main#50cab2380103c39c14765a10bdc4b38a74082285"
|
301
303
|
dependencies = [
|
302
304
|
"magnus-macros",
|
303
305
|
"rb-sys",
|
@@ -308,7 +310,7 @@ dependencies = [
|
|
308
310
|
[[package]]
|
309
311
|
name = "magnus-macros"
|
310
312
|
version = "0.4.0"
|
311
|
-
source = "git+https://github.com/matsadler/magnus?branch=main#
|
313
|
+
source = "git+https://github.com/matsadler/magnus?branch=main#50cab2380103c39c14765a10bdc4b38a74082285"
|
312
314
|
dependencies = [
|
313
315
|
"proc-macro2",
|
314
316
|
"quote",
|
@@ -443,18 +445,18 @@ dependencies = [
|
|
443
445
|
|
444
446
|
[[package]]
|
445
447
|
name = "rb-sys"
|
446
|
-
version = "0.9.
|
448
|
+
version = "0.9.79"
|
447
449
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
448
|
-
checksum = "
|
450
|
+
checksum = "939fb78db3e4f26665c1d4c7b91ca66d3578335a19aba552d4a6445811d07072"
|
449
451
|
dependencies = [
|
450
452
|
"rb-sys-build",
|
451
453
|
]
|
452
454
|
|
453
455
|
[[package]]
|
454
456
|
name = "rb-sys-build"
|
455
|
-
version = "0.9.
|
457
|
+
version = "0.9.79"
|
456
458
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
457
|
-
checksum = "
|
459
|
+
checksum = "335a95eb0420d52fa94ef12019df3c2c250c6b19cbb3c60bd05cb7e9c362072c"
|
458
460
|
dependencies = [
|
459
461
|
"bindgen",
|
460
462
|
"lazy_static",
|
@@ -418,10 +418,10 @@ impl MmapedFile {
|
|
418
418
|
|
419
419
|
raw_str.as_mut().as_.heap.ptr = self.as_mut_ptr().offset(offset);
|
420
420
|
|
421
|
-
let current_len =
|
421
|
+
let current_len = str.len() as c_long;
|
422
422
|
let new_shared_len = old_cap + current_len;
|
423
423
|
|
424
|
-
|
424
|
+
self.update_rstring_len(raw_str, new_shared_len);
|
425
425
|
continue;
|
426
426
|
}
|
427
427
|
|
@@ -436,7 +436,7 @@ impl MmapedFile {
|
|
436
436
|
//
|
437
437
|
// See https://gitlab.com/gitlab-org/ruby/gems/prometheus-client-mmap/-/issues/45
|
438
438
|
raw_str.as_mut().as_.heap.ptr = self.as_mut_ptr();
|
439
|
-
|
439
|
+
self.update_rstring_len(raw_str, new_len);
|
440
440
|
}
|
441
441
|
}
|
442
442
|
|
@@ -632,6 +632,16 @@ impl MmapedFile {
|
|
632
632
|
unsafe fn rb_string_internal(rb_str: RString) -> NonNull<rb_sys::RString> {
|
633
633
|
mem::transmute::<RString, NonNull<rb_sys::RString>>(rb_str)
|
634
634
|
}
|
635
|
+
|
636
|
+
#[cfg(ruby_lte_3_2)]
|
637
|
+
unsafe fn update_rstring_len(&self, mut raw_str: NonNull<rb_sys::RString>, new_len: c_long) {
|
638
|
+
raw_str.as_mut().as_.heap.len = new_len;
|
639
|
+
}
|
640
|
+
|
641
|
+
#[cfg(ruby_gte_3_3)]
|
642
|
+
unsafe fn update_rstring_len(&self, mut raw_str: NonNull<rb_sys::RString>, new_len: c_long) {
|
643
|
+
raw_str.as_mut().len = new_len;
|
644
|
+
}
|
635
645
|
}
|
636
646
|
|
637
647
|
#[cfg(test)]
|
@@ -772,8 +782,7 @@ mod test {
|
|
772
782
|
if str.as_raw() == child_id {
|
773
783
|
assert_eq!(parent_id, raw_str.as_ref().as_.heap.aux.shared);
|
774
784
|
|
775
|
-
let child_offset =
|
776
|
-
mmap_len as isize - raw_str.as_ref().as_.heap.len as isize;
|
785
|
+
let child_offset = mmap_len as isize - str.len() as isize;
|
777
786
|
assert_eq!(mmap_ptr.offset(child_offset), raw_str.as_ref().as_.heap.ptr);
|
778
787
|
|
779
788
|
child_checked = true;
|
@@ -781,7 +790,7 @@ mod test {
|
|
781
790
|
assert_eq!(parent_id, str.as_raw());
|
782
791
|
|
783
792
|
assert_eq!(mmap_ptr, raw_str.as_ref().as_.heap.ptr);
|
784
|
-
assert_eq!(mmap_len as c_long,
|
793
|
+
assert_eq!(mmap_len as c_long, str.len() as c_long);
|
785
794
|
assert!(raw_str.as_ref().basic.flags & (STR_SHARED | STR_NOEMBED) > 0);
|
786
795
|
assert!(str.is_frozen());
|
787
796
|
|
data/lib/2.7/fast_mmaped_file.so
CHANGED
Binary file
|
Binary file
|
data/lib/3.0/fast_mmaped_file.so
CHANGED
Binary file
|
Binary file
|
data/lib/3.1/fast_mmaped_file.so
CHANGED
Binary file
|
Binary file
|
data/lib/3.2/fast_mmaped_file.so
CHANGED
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: 0.
|
4
|
+
version: 0.25.0
|
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: 2023-06-
|
14
|
+
date: 2023-06-15 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rb_sys
|
@@ -150,6 +150,7 @@ files:
|
|
150
150
|
- ext/fast_mmaped_file_rs/Cargo.lock
|
151
151
|
- ext/fast_mmaped_file_rs/Cargo.toml
|
152
152
|
- ext/fast_mmaped_file_rs/README.md
|
153
|
+
- ext/fast_mmaped_file_rs/build.rs
|
153
154
|
- ext/fast_mmaped_file_rs/extconf.rb
|
154
155
|
- ext/fast_mmaped_file_rs/src/error.rs
|
155
156
|
- ext/fast_mmaped_file_rs/src/file_entry.rs
|