omq-ractor 0.1.5 → 0.1.7

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/lib/omq/ractor.rb +10 -17
  4. metadata +7 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b37fbceaf8b22765e84ec6f0ee63d5fb290e227d88c5abab8d0f85f6169d028b
4
- data.tar.gz: 5e75dccb8bdd313ae0cb1c25e79b9a10d9e13decb98d6ad042babebbcdea7437
3
+ metadata.gz: 33bdfec66293ba5838114ae557b6ce2f1e99f52e6b930fd8cfad82bf97950827
4
+ data.tar.gz: c7370bc226312e82c3aafba801bfbc29a743c4fbfeb2d8ea028f23ec0b9a6ac9
5
5
  SHA512:
6
- metadata.gz: d2d2de879b721455d8d8f2e826f8c4de9e524f3a3f152fda0eee0b31410a0b9b7d2ec42d340288082e57647b1948789eb98aaa6138a177ea373e33b229f9190f
7
- data.tar.gz: 2baa73f333c9600f9215ac3e49aea2de1149ea89786be62b8699b851000304f7b00078075026099bf1ec9074546d688027e3ae977e9ff6ce68b2a549894b8874
6
+ metadata.gz: 5cbc8e3b3c4c3c712d4da7015e78a0e6a970a2cdeea377a41ceb9c9bcfde5e63aca9dff7320fe6ab1c5d7669f6d2d91b345d357ea183accf9ca1684e892579d6
7
+ data.tar.gz: 4f97b42bc7835c12dc89c47390e4d6b80119db3c7eb0852be9508b8f5e633cb7b3e1e0f85db5d6776088745434591d448a51d0b89eb7b65c6a8fc6696c9bc914
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # OMQ::Ractor -- Networked Ractors
2
2
 
3
- [![CI](https://github.com/paddor/omq-ractor/actions/workflows/ci.yml/badge.svg)](https://github.com/paddor/omq-ractor/actions/workflows/ci.yml)
3
+ [![CI](https://github.com/zeromq/omq.rb/actions/workflows/ci.yml/badge.svg)](https://github.com/zeromq/omq.rb/actions/workflows/ci.yml)
4
4
  [![Gem Version](https://img.shields.io/gem/v/omq-ractor?color=e9573f)](https://rubygems.org/gems/omq-ractor)
5
5
  [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](LICENSE)
6
6
  [![Ruby](https://img.shields.io/badge/Ruby-%3E%3D%204.0-CC342D?logo=ruby&logoColor=white)](https://www.ruby-lang.org)
@@ -119,7 +119,7 @@ end
119
119
  ```
120
120
 
121
121
  Topic prefix matching works normally. The topic stays as a plain string
122
- frame; only the payload is serialized.
122
+ frame. Only the payload is serialized.
123
123
 
124
124
  ### Worker pool
125
125
 
@@ -215,7 +215,7 @@ a Reactor.run round-trip per message.
215
215
  Setup handshake: the worker must call `omq.sockets` as its first
216
216
  action. This creates worker-owned input ports, sends them to the main
217
217
  Ractor, and returns SocketProxy objects. The main Ractor waits up to
218
- 100ms; if the handshake doesn't complete, the Ractor is stopped and
218
+ 100ms. If the handshake doesn't complete, the Ractor is stopped and
219
219
  an error is raised.
220
220
 
221
221
 
data/lib/omq/ractor.rb CHANGED
@@ -31,7 +31,7 @@ module OMQ
31
31
  #
32
32
  class Ractor
33
33
 
34
- HANDSHAKE_TIMEOUT = 5
34
+ HANDSHAKE_TIMEOUT = 1
35
35
 
36
36
 
37
37
  # Socket types that use topic/group-based routing.
@@ -43,7 +43,7 @@ module OMQ
43
43
  # -- Connection wrappers -------------------------------------------
44
44
 
45
45
  # Mixed into all connection wrappers so is_a? checks against
46
- # the wrapped class (e.g. DirectPipe) still work.
46
+ # the wrapped class (e.g. Pipe) still work.
47
47
  #
48
48
  module TransparentDelegator
49
49
  # @param klass [Class] class to check against
@@ -121,7 +121,7 @@ module OMQ
121
121
  end
122
122
 
123
123
 
124
- # Wraps an inproc DirectPipe with Ractor.make_shareable.
124
+ # Wraps an inproc Pipe with Ractor.make_shareable.
125
125
  #
126
126
  class ShareableConnection < SimpleDelegator
127
127
  include TransparentDelegator
@@ -525,10 +525,10 @@ module OMQ
525
525
  @sockets.each_with_index do |socket, i|
526
526
  cache = SerializeCache.new
527
527
  topic_type = socket_configs[i][:topic_type]
528
- engine = socket.instance_variable_get(:@engine)
528
+ engine = socket.engine
529
529
 
530
530
  engine.connection_wrapper = ->(conn) do
531
- inproc = conn.is_a?(Transport::Inproc::DirectPipe)
531
+ inproc = conn.is_a?(Transport::Inproc::Pipe)
532
532
  if topic_type
533
533
  inproc ? TopicShareableConnection.new(conn) : TopicMarshalConnection.new(conn, cache)
534
534
  else
@@ -579,11 +579,9 @@ module OMQ
579
579
  port = output_ports[i]
580
580
  next unless port
581
581
 
582
- do_serialize = socket_configs[i][:serialize]
583
- topic_type = socket_configs[i][:topic_type]
584
- engine = socket.instance_variable_get(:@engine)
585
- queue = Thread::Queue.new
586
- rd, wr = IO.pipe
582
+ engine = socket.engine
583
+ queue = Thread::Queue.new
584
+ rd, wr = IO.pipe
587
585
  @output_pipes << rd << wr
588
586
 
589
587
  # Thread: port.receive -> queue + pipe signal
@@ -607,13 +605,8 @@ module OMQ
607
605
  rd.read_nonblock(4096) rescue nil
608
606
 
609
607
  while (msg = queue.pop(true) rescue nil)
610
- if do_serialize
611
- parts = topic_type && msg.is_a?(Array) ? msg : [msg]
612
- engine.enqueue_send(parts)
613
- else
614
- parts = socket.__send__(:freeze_message, msg)
615
- engine.enqueue_send(parts)
616
- end
608
+ parts = msg.is_a?(Array) ? msg : [msg]
609
+ engine.enqueue_send(parts)
617
610
  end
618
611
  rescue IOError, Async::Stop
619
612
  break
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omq-ractor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrik Wenger
@@ -13,16 +13,16 @@ dependencies:
13
13
  name: omq
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - ">="
16
+ - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: '0.19'
18
+ version: '0.28'
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
- - - ">="
23
+ - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: '0.19'
25
+ version: '0.28'
26
26
  email:
27
27
  - paddor@gmail.com
28
28
  executables: []
@@ -33,7 +33,7 @@ files:
33
33
  - README.md
34
34
  - lib/omq-ractor.rb
35
35
  - lib/omq/ractor.rb
36
- homepage: https://github.com/paddor/omq-ractor
36
+ homepage: https://github.com/zeromq/omq.rb/tree/main/gems/omq-ractor
37
37
  licenses:
38
38
  - ISC
39
39
  metadata: {}
@@ -51,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
51
51
  - !ruby/object:Gem::Version
52
52
  version: '0'
53
53
  requirements: []
54
- rubygems_version: 4.0.6
54
+ rubygems_version: 4.0.16
55
55
  specification_version: 4
56
56
  summary: Bridge OMQ sockets into Ruby Ractors for true parallel processing
57
57
  test_files: []