prometheus-client-mmap 0.7.0.beta25 → 0.7.0.beta26

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
  SHA1:
3
- metadata.gz: e500c6da78e70d1570d6b8d5a02f1ae3ba6626bd
4
- data.tar.gz: 3d85b4063e37377637c1d31cd32b6f69d41c4972
3
+ metadata.gz: f086e3c44e2839e24cf984fe1d900eebe1a4c486
4
+ data.tar.gz: 134edab2af138f3fd3b7c50eda90a49bad59f995
5
5
  SHA512:
6
- metadata.gz: a253bd79d0af738d7845b930aed71125efab25fc0e0d8a6a3264bce806cf263fd0cd444108af190ce07924f42c588a296b901f583419e02e7ca04deb11303f2a
7
- data.tar.gz: aa81ccfc3be8038d88588ee0d53bf8effae894da712040a1fe6d53d3f505c6839d3c8601a59ec99cb641820ff3f280bbab9e5c3b5dbe9d6e9b7fff943e1a6cc5
6
+ metadata.gz: 2e72e61bde828fb4fb36f76066e18c7656dbae957136a75ceb11f78e095183184e188dbc348a883293fe5542b2636674f601a9740b8543b2849318338d019f0b
7
+ data.tar.gz: 6fdf77bd432a2cca25f1eee7baa412ccf5489823584a87dc1ff6635f71bb1d8026861a54618283f02ff0c7b760acd27e53c8b3997b9eb39a5e99537091d442b1
@@ -0,0 +1,27 @@
1
+ #include <ruby.h>
2
+ #include "mmap.h"
3
+
4
+ VALUE MMAPED_FILE = Qnil;
5
+
6
+
7
+ VALUE method_get_double(VALUE self, VALUE index) {
8
+ mm_ipc *i_mm;
9
+ GetMmap(self, i_mm, MM_MODIFY);
10
+
11
+ Check_Type(index, T_FIXNUM);
12
+ size_t idx = NUM2UINT(index);
13
+
14
+ if ((i_mm->t->real + sizeof(double)) <= idx) {
15
+ rb_raise(rb_eIndexError, "index %ld out of string", idx);
16
+ }
17
+
18
+ double tmp;
19
+
20
+ memcpy(&tmp, (char *)i_mm->t->addr + idx, sizeof(double));
21
+ return DBL2NUM(tmp);
22
+ }
23
+
24
+ void Init_fast_mmaped_file() {
25
+ MMAPED_FILE = rb_define_module("FastMmapedFile");
26
+ rb_define_method(MMAPED_FILE, "get_double", method_get_double, 1);
27
+ }
@@ -0,0 +1,58 @@
1
+ #ifndef MMAP_H
2
+ #define MMAP_H
3
+
4
+ #define MM_MODIFY 1
5
+ #define MM_ORIGIN 2
6
+ #define MM_CHANGE (MM_MODIFY | 4)
7
+ #define MM_PROTECT 8
8
+
9
+ #define MM_FROZEN (1 << 0)
10
+ #define MM_FIXED (1 << 1)
11
+ #define MM_ANON (1 << 2)
12
+ #define MM_LOCK (1 << 3)
13
+ #define MM_IPC (1 << 4)
14
+ #define MM_TMP (1 << 5)
15
+
16
+ #ifndef MMAP_RETTYPE
17
+ #ifndef _POSIX_C_SOURCE
18
+ #define _POSIX_C_SOURCE 199309
19
+ #endif /* !_POSIX_C_SOURCE */
20
+ #ifdef _POSIX_VERSION
21
+ #if _POSIX_VERSION >= 199309
22
+ #define MMAP_RETTYPE void *
23
+ #endif /* _POSIX_VERSION >= 199309 */
24
+ #endif /* _POSIX_VERSION */
25
+ #endif /* !MMAP_RETTYPE */
26
+
27
+ #ifndef MMAP_RETTYPE
28
+ #define MMAP_RETTYPE caddr_t
29
+ #endif
30
+
31
+ typedef struct {
32
+ MMAP_RETTYPE addr;
33
+ int smode, pmode, vscope;
34
+ int advice, flag;
35
+ VALUE key;
36
+ int semid, shmid;
37
+ size_t len, real, incr;
38
+ off_t offset;
39
+ char *path, *template;
40
+ } mm_mmap;
41
+
42
+ typedef struct {
43
+ int count;
44
+ mm_mmap *t;
45
+ } mm_ipc;
46
+
47
+
48
+ #define GetMmap(obj, i_mm, t_modify) \
49
+ Data_Get_Struct(obj, mm_ipc, i_mm); \
50
+ if (!i_mm->t->path) { \
51
+ rb_raise(rb_eIOError, "unmapped file"); \
52
+ } \
53
+ if ((t_modify & MM_MODIFY) && (i_mm->t->flag & MM_FROZEN)) { \
54
+ rb_error_frozen("mmap"); \
55
+ }
56
+
57
+
58
+ #endif
Binary file
@@ -1,5 +1,5 @@
1
1
  module Prometheus
2
2
  module Client
3
- VERSION = '0.7.0.beta25'.freeze
3
+ VERSION = '0.7.0.beta26'.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.7.0.beta25
4
+ version: 0.7.0.beta26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Schmidt
@@ -70,6 +70,8 @@ extra_rdoc_files: []
70
70
  files:
71
71
  - README.md
72
72
  - ext/fast_mmaped_file/extconf.rb
73
+ - ext/fast_mmaped_file/fast_mmaped_file.c
74
+ - ext/fast_mmaped_file/mmap.h
73
75
  - lib/fast_mmaped_file.bundle
74
76
  - lib/prometheus.rb
75
77
  - lib/prometheus/client.rb