prometheus-client-mmap 0.24.5-x86_64-linux → 0.25.0-x86_64-linux

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1207aad86766a410bc9b90eee5b83ae1785f9c36fb34ac79a3bc56a44ce9d7ed
4
- data.tar.gz: b1cc8b946f96ff5f26de048492159e162cb7831d11f3b724f01988aca1e1da94
3
+ metadata.gz: 8392f2d676133039741efc162c8365a692a8dd3ce2d584af4a97f40ed39981db
4
+ data.tar.gz: '01139643ee538a1c765f86cc54c2ab36a72282d6484378ba713041f30385ece8'
5
5
  SHA512:
6
- metadata.gz: ca3048cd9a5829d78a1a091554d33434188b6a49babe0b73ece6c508c0c7514cf54da7dc89c74bf26ecae9642fd54a89da9990be03877631942d99c81113306c
7
- data.tar.gz: 554ca7fa38267fa42e13d024e22f03cb96c34cc882f97d21a351b1248827cc6ab41104ad067ed2f33e3b03f4f507b344e94a9887a6d5bff737ef0878c6175d40
6
+ metadata.gz: 9bace69a5e6398cc35ee32aad8b0ca99229e6e5313b6a9bb4f54aa767c24ddef2780c89759ce17586732c82d456782a53818dae8d9cf459962c894324f690b3e
7
+ data.tar.gz: 6b13dc1cad92df550e802addaceec0891d720ee602b1083cc8e82cd35523b3ca74614c171fe13300992b342fba67bc16374718629a794246031f76a6cf0f7ce3
@@ -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
- RSTRING(i)->as.heap.len = i_mm->t->real;
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
- RSTRING(ret)->as.heap.len = i_mm->t->real;
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.60.1"
33
+ version = "0.62.0"
34
34
  source = "registry+https://github.com/rust-lang/crates.io-index"
35
- checksum = "062dddbc1ba4aca46de6338e2bf87771414c335f7b2f2036e8f3e9befebf88e6"
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#b10aab48119eb87a872bf0bb4480b1fcebe5d1b9"
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#b10aab48119eb87a872bf0bb4480b1fcebe5d1b9"
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.71"
448
+ version = "0.9.79"
447
449
  source = "registry+https://github.com/rust-lang/crates.io-index"
448
- checksum = "156bfedced1e236600bcaad538477097ff2ed5c6b474e411d15b791e1d24c0f1"
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.71"
457
+ version = "0.9.79"
456
458
  source = "registry+https://github.com/rust-lang/crates.io-index"
457
- checksum = "5cb2e4a32cbc290b543a74567072ad24b708aff7bb5dde5a68d5690379cd7938"
459
+ checksum = "335a95eb0420d52fa94ef12019df3c2c250c6b19cbb3c60bd05cb7e9c362072c"
458
460
  dependencies = [
459
461
  "bindgen",
460
462
  "lazy_static",
@@ -27,6 +27,9 @@ rand = "0.8"
27
27
  sha2 = "0.10"
28
28
  tempfile = "3.5"
29
29
 
30
+ [build-dependencies]
31
+ rb-sys-env = "0.1"
32
+
30
33
  [lib]
31
34
  # Integration tests won't work if crate is only `cdylib`.
32
35
  crate-type = ["cdylib","lib"]
@@ -0,0 +1,5 @@
1
+ fn main() -> Result<(), Box<dyn std::error::Error>> {
2
+ let _ = rb_sys_env::activate()?;
3
+
4
+ Ok(())
5
+ }
@@ -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 = raw_str.as_ref().as_.heap.len;
421
+ let current_len = str.len() as c_long;
422
422
  let new_shared_len = old_cap + current_len;
423
423
 
424
- raw_str.as_mut().as_.heap.len = new_shared_len;
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
- raw_str.as_mut().as_.heap.len = new_len;
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, raw_str.as_ref().as_.heap.len);
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
 
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,5 +1,5 @@
1
1
  module Prometheus
2
2
  module Client
3
- VERSION = '0.24.5'.freeze
3
+ VERSION = '0.25.0'.freeze
4
4
  end
5
5
  end
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.24.5
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-13 00:00:00.000000000 Z
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