sysvmq 0.2.1 → 0.2.3

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
- SHA1:
3
- metadata.gz: 9b62bd6b368c988aa1821158c4a68eade4d2dd28
4
- data.tar.gz: 1722201de77944fd64324927a0c681f08b700596
2
+ SHA256:
3
+ metadata.gz: c3861499e9f5511851b3e0fa8077b255766095843247b58afe465f81e0d01faa
4
+ data.tar.gz: 315108a5a3ac5eb94e3f3d7f8b2a1e21bacce32f713160184a9f9a429b78ee37
5
5
  SHA512:
6
- metadata.gz: 6810448b3b02f863bb4a0989d0b45b36693ecdb3ef68252a2beb5578367741910b5e7193d61307d65d7fe252e8c5dcdfe73995a4eb659ad2ba399f1f22ba2bec
7
- data.tar.gz: e986084ee94f00982699a93cc67063a58d7f43db3c2e15b4d4d36bcd506cccfc25e2b386b77c49d6f92ff7f5fb4e3be1426b076296c9553e017fe5c88f2adf4a
6
+ metadata.gz: f9b55b44e92fb180e06286ac49dffc86083713dcecd2745e9d2d649232213993315d0595aed9f6b446a8fa9806a7cbd454be06594472c9a65c2340fb671ef7f6
7
+ data.tar.gz: d15b976f57a52a2239424231b495345d5bb884205ec055522beadb0eb43d199ebe88e164492567fdd943ccefe44cd4b8e5227b4d7c150c00ffa807a63a3a5e27
@@ -0,0 +1,19 @@
1
+ name: CI
2
+ on: [push]
3
+
4
+ jobs:
5
+ tests:
6
+ runs-on: ubuntu-latest
7
+ strategy:
8
+ matrix:
9
+ ruby: [ '2.5', '2.6', '2.7', '3.0', '3.1', '3.2' ]
10
+ name: Ruby ${{ matrix.ruby }} Tests
11
+ steps:
12
+ - uses: actions/checkout@v3
13
+ - name: Set up Ruby
14
+ uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: ${{ matrix.ruby }}
17
+ bundler-cache: true
18
+ - name: Run tests
19
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -1,6 +1,7 @@
1
1
  *.gem
2
2
  *.rbc
3
- .bundle
3
+ *.bundle
4
+ *.so
4
5
  .config
5
6
  .yardoc
6
7
  Gemfile.lock
data/Gemfile CHANGED
@@ -1,4 +1,9 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in sysv-mq.gemspec
4
+
5
+ gem "rake"
6
+ gem "rake-compiler"
7
+ gem "minitest"
8
+
4
9
  gemspec
data/README.md CHANGED
@@ -12,9 +12,12 @@ implemented on OS X, which POSIX MQs are not.
12
12
  Note that `sysvmq` doesn't rely on any third-party message broker. The message
13
13
  queue is handled by the kernel. It's extremely stable and performant.
14
14
 
15
+ `sysvmq` has been tested heavily in production at Shopify, under more than `100k
16
+ RPS` and is still in use as of Feb, 2020.
17
+
15
18
  ## Installation
16
19
 
17
- Add `sysvm` to your Gemfile.
20
+ Add `sysvmq` to your Gemfile.
18
21
 
19
22
  `gem 'sysvmq'`
20
23
 
data/ext/extconf.rb CHANGED
@@ -4,7 +4,4 @@ have_header 'sys/ipc.h'
4
4
  have_header 'sys/msg.h'
5
5
  have_header 'sys/types.h'
6
6
 
7
- have_func 'rb_thread_blocking_region'
8
- have_func 'rb_thread_call_without_gvl'
9
-
10
7
  create_makefile 'sysvmq'
data/ext/sysvmq.c CHANGED
@@ -14,20 +14,10 @@
14
14
 
15
15
  #define UNINITIALIZED_ERROR -2
16
16
 
17
- #if defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL) && defined(HAVE_RUBY_THREAD_H)
18
- // 2.0
19
17
  #include <ruby/thread.h>
20
18
  #define WITHOUT_GVL(fn,a,ubf,b) \
21
19
  rb_thread_call_without_gvl((fn),(a),(ubf),(b))
22
20
 
23
- #elif defined(HAVE_RB_THREAD_BLOCKING_REGION)
24
- // 1.9
25
- typedef VALUE (*my_blocking_fn_t)(void*);
26
- #define WITHOUT_GVL(fn,a,ubf,b) \
27
- rb_thread_blocking_region((my_blocking_fn_t)(fn),(a),(ubf),(b))
28
-
29
- #endif
30
-
31
21
  // This is the buffer passed to msg{rcv,snd,ctl}(2)
32
22
  typedef struct {
33
23
  long mtype;
@@ -47,12 +37,6 @@ typedef struct {
47
37
  }
48
38
  sysvmq_t;
49
39
 
50
- static void
51
- sysvmq_mark(void *ptr)
52
- {
53
- // noop, no Ruby objects in the internal struct currently
54
- }
55
-
56
40
  static void
57
41
  sysvmq_free(void *ptr)
58
42
  {
@@ -70,12 +54,13 @@ sysvmq_memsize(const void* ptr)
70
54
 
71
55
  static const rb_data_type_t
72
56
  sysvmq_type = {
73
- "sysvmq_type",
74
- {
75
- sysvmq_mark,
76
- sysvmq_free,
77
- sysvmq_memsize
78
- }
57
+ .wrap_struct_name = "sysvmq_type",
58
+ .function = {
59
+ .dmark = NULL, // no Ruby objects in the internal struct currently
60
+ .dfree = sysvmq_free,
61
+ .dsize = sysvmq_memsize,
62
+ },
63
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED
79
64
  };
80
65
 
81
66
  static VALUE
@@ -282,6 +267,8 @@ sysvmq_send(int argc, VALUE *argv, VALUE self)
282
267
  if (argc >= 2) priority = argv[1];
283
268
  if (argc == 3) flags = argv[2];
284
269
 
270
+ message = rb_funcall(message, rb_intern("to_s"), 0);
271
+
285
272
  TypedData_Get_Struct(self, sysvmq_t, &sysvmq_type, sysv);
286
273
 
287
274
  Check_Type(flags, T_FIXNUM);
data/sysvmq.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "sysvmq"
7
- spec.version = '0.2.1'
7
+ spec.version = '0.2.3'
8
8
  spec.authors = ["Simon Eskildsen"]
9
9
  spec.email = ["sirup@sirupsen.com"]
10
10
  spec.summary = %q{Ruby wrapper for SysV Message Queues}
@@ -12,13 +12,11 @@ Gem::Specification.new do |spec|
12
12
  spec.homepage = "https://github.com/Sirupsen/sysvmq"
13
13
  spec.license = "MIT"
14
14
 
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
16
+
15
17
  spec.files = `git ls-files`.split($/)
16
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
20
  spec.require_paths = ["lib"]
19
21
  spec.extensions = ["ext/extconf.rb"]
20
-
21
- spec.add_development_dependency "bundler"
22
- spec.add_development_dependency "rake"
23
- spec.add_development_dependency "rake-compiler", "~> 0.9"
24
22
  end
data/test/sysv_mq_test.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #coding: utf-8
2
2
  require_relative 'test_helper'
3
3
 
4
- class SysVMQTest < MiniTest::Unit::TestCase
4
+ class SysVMQTest < MiniTest::Test
5
5
  def setup
6
6
  @size = 1024
7
7
  @mq = SysVMQ.new(0xDEADC0DE, @size, SysVMQ::IPC_CREAT | 0666)
@@ -130,4 +130,18 @@ class SysVMQTest < MiniTest::Unit::TestCase
130
130
  @mq.send(message)
131
131
  assert_equal message, @mq.receive
132
132
  end
133
+
134
+ def test_number_converted_to_string
135
+ message = 1
136
+ @mq.send(message)
137
+ assert_equal "1", @mq.receive
138
+ end
139
+
140
+ class Walrus; def to_s; "walrus"; end; end
141
+
142
+ def test_object_converted_to_string
143
+ message = Walrus.new
144
+ @mq.send(message)
145
+ assert_equal "walrus", @mq.receive
146
+ end
133
147
  end
data/test/test_helper.rb CHANGED
@@ -1,3 +1,2 @@
1
- require 'minitest/unit'
2
1
  require 'minitest/autorun'
3
2
  require 'sysvmq'
metadata CHANGED
@@ -1,57 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sysvmq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Eskildsen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-25 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rake-compiler
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '0.9'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '0.9'
11
+ date: 2023-03-11 00:00:00.000000000 Z
12
+ dependencies: []
55
13
  description: Ruby wrapper for SysV Message Queues
56
14
  email:
57
15
  - sirup@sirupsen.com
@@ -60,8 +18,8 @@ extensions:
60
18
  - ext/extconf.rb
61
19
  extra_rdoc_files: []
62
20
  files:
21
+ - ".github/workflows/tests.yml"
63
22
  - ".gitignore"
64
- - ".travis.yml"
65
23
  - Gemfile
66
24
  - LICENSE.txt
67
25
  - README.md
@@ -78,7 +36,7 @@ homepage: https://github.com/Sirupsen/sysvmq
78
36
  licenses:
79
37
  - MIT
80
38
  metadata: {}
81
- post_install_message:
39
+ post_install_message:
82
40
  rdoc_options: []
83
41
  require_paths:
84
42
  - lib
@@ -86,16 +44,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
86
44
  requirements:
87
45
  - - ">="
88
46
  - !ruby/object:Gem::Version
89
- version: '0'
47
+ version: 2.5.0
90
48
  required_rubygems_version: !ruby/object:Gem::Requirement
91
49
  requirements:
92
50
  - - ">="
93
51
  - !ruby/object:Gem::Version
94
52
  version: '0'
95
53
  requirements: []
96
- rubyforge_project:
97
- rubygems_version: 2.2.0
98
- signing_key:
54
+ rubygems_version: 3.3.7
55
+ signing_key:
99
56
  specification_version: 4
100
57
  summary: Ruby wrapper for SysV Message Queues
101
58
  test_files:
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 1.9.3
4
- - 2.0.0
5
- - 2.1.0