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.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/omq/ractor.rb +10 -17
- metadata +7 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 33bdfec66293ba5838114ae557b6ce2f1e99f52e6b930fd8cfad82bf97950827
|
|
4
|
+
data.tar.gz: c7370bc226312e82c3aafba801bfbc29a743c4fbfeb2d8ea028f23ec0b9a6ac9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
[](https://github.com/zeromq/omq.rb/actions/workflows/ci.yml)
|
|
4
4
|
[](https://rubygems.org/gems/omq-ractor)
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
[](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
|
|
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
|
|
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 =
|
|
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.
|
|
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
|
|
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.
|
|
528
|
+
engine = socket.engine
|
|
529
529
|
|
|
530
530
|
engine.connection_wrapper = ->(conn) do
|
|
531
|
-
inproc = conn.is_a?(Transport::Inproc::
|
|
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
|
-
|
|
583
|
-
|
|
584
|
-
|
|
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
|
-
|
|
611
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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/
|
|
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.
|
|
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: []
|