cztop 1.2.2 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +9 -0
- data/README.md +18 -8
- data/cztop.gemspec +1 -1
- data/lib/cztop/actor.rb +1 -1
- data/lib/cztop/message/frames.rb +1 -1
- data/lib/cztop/message.rb +4 -2
- data/lib/cztop/polymorphic_zsock_methods.rb +3 -0
- data/lib/cztop/send_receive_methods.rb +1 -1
- data/lib/cztop/socket.rb +1 -1
- data/lib/cztop/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c158b4eded1b181765d923d869fc6b9f959313f7640bfc3dc8b47b113dcf4d5c
|
4
|
+
data.tar.gz: afcca2379f96a9569f1776938873767fcbaaa78ec3a08faf2f860b17b42b6f34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4ab7318be7ef914957517c7dc8bb9d4030faa89b86de08479d5ad4fcc63b544745f19d0945d119898a378855f51039788f89df0dd3b9994ec2801100d5f31c3
|
7
|
+
data.tar.gz: 3d68e63fb44e994bcac69c76855991c8f71a4c275f76c9afcd728ccc3d3e906d1f25359bf36861136ac8252e6b433bcbec81047217a18052900a7ae3e302f0ce
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
1.2.4 (1/16/2024)
|
2
|
+
-----
|
3
|
+
* PolymorphicZsockMethods#wait: fail with NotImplementedError inside non-blocking Fibers
|
4
|
+
* fail with ArgumentError when sending message with no parts
|
5
|
+
|
6
|
+
1.2.3 (1/7/2024)
|
7
|
+
-----
|
8
|
+
* no changes, just re-release to update README on https://www.rubydoc.info/gems/cztop
|
9
|
+
|
1
10
|
1.2.2 (1/7/2024)
|
2
11
|
-----
|
3
12
|
* restore compatibility with Ruby 3.0+
|
data/README.md
CHANGED
@@ -18,26 +18,33 @@ See [this example](https://github.com/paddor/cztop/blob/master/examples/async.rb
|
|
18
18
|
```ruby
|
19
19
|
#! /usr/bin/env ruby
|
20
20
|
|
21
|
-
require '
|
21
|
+
require 'bundler/inline'
|
22
|
+
|
23
|
+
gemfile do
|
24
|
+
source 'https://rubygems.org'
|
25
|
+
gem 'cztop', path: '../../'
|
26
|
+
gem 'async'
|
27
|
+
end
|
28
|
+
|
29
|
+
ENDPOINT = 'inproc://req_rep_example'
|
30
|
+
# ENDPOINT = 'ipc:///tmp/req_rep_example0'
|
31
|
+
# ENDPOINT = 'tcp://localhost:5556'
|
22
32
|
|
23
33
|
Async do |task|
|
24
|
-
task.async do |t|
|
25
|
-
socket = CZTop::Socket::REP.new
|
26
|
-
socket.options.rcvtimeo = 50 # ms
|
34
|
+
rep_task = task.async do |t|
|
35
|
+
socket = CZTop::Socket::REP.new ENDPOINT
|
27
36
|
|
28
37
|
loop do
|
29
38
|
msg = socket.receive
|
30
39
|
puts "<<< #{msg.to_a.inspect}"
|
31
40
|
socket << msg.to_a.map(&:upcase)
|
32
|
-
rescue IO::TimeoutError
|
33
|
-
break
|
34
41
|
end
|
35
|
-
|
42
|
+
ensure
|
36
43
|
puts "REP done."
|
37
44
|
end
|
38
45
|
|
39
46
|
task.async do
|
40
|
-
socket = CZTop::Socket::REQ.new
|
47
|
+
socket = CZTop::Socket::REQ.new ENDPOINT
|
41
48
|
|
42
49
|
10.times do |i|
|
43
50
|
socket << "foobar ##{i}"
|
@@ -46,6 +53,7 @@ Async do |task|
|
|
46
53
|
end
|
47
54
|
|
48
55
|
puts "REQ done."
|
56
|
+
rep_task.stop
|
49
57
|
end
|
50
58
|
end
|
51
59
|
```
|
@@ -85,6 +93,8 @@ Executed in 401.51 millis fish external
|
|
85
93
|
|
86
94
|
```
|
87
95
|
|
96
|
+
A slightly more complex version (more sockets) is [here](https://github.com/paddor/cztop/blob/master/examples/massive_async.rb).
|
97
|
+
|
88
98
|
## Overview
|
89
99
|
|
90
100
|
### Features
|
data/cztop.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.license = "ISC"
|
15
15
|
spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
|
16
16
|
|
17
|
-
spec.metadata["homepage_uri"] =
|
17
|
+
spec.metadata["homepage_uri"] = "https://github.com/paddor/cztop"
|
18
18
|
spec.metadata["source_code_uri"] = "https://github.com/paddor/cztop"
|
19
19
|
spec.metadata["changelog_uri"] = "https://github.com/paddor/cztop/blob/master/CHANGES.md"
|
20
20
|
|
data/lib/cztop/actor.rb
CHANGED
data/lib/cztop/message/frames.rb
CHANGED
data/lib/cztop/message.rb
CHANGED
@@ -32,7 +32,7 @@ module CZTop
|
|
32
32
|
end
|
33
33
|
|
34
34
|
|
35
|
-
# @return [Boolean] if this message is empty or not
|
35
|
+
# @return [Boolean] if this message is empty or not (no frames or every frame has length zero)
|
36
36
|
def empty?
|
37
37
|
content_size.zero?
|
38
38
|
end
|
@@ -56,11 +56,13 @@ module CZTop
|
|
56
56
|
# corresponding
|
57
57
|
# to the given routing ID)
|
58
58
|
# @raise [ArgumentError] if the message is invalid, e.g. when trying to
|
59
|
-
# send a multi-part message over a CLIENT/SERVER socket
|
59
|
+
# send a message with a no parts, or a multi-part message over a CLIENT/SERVER socket
|
60
60
|
# @raise [SystemCallError] for any other error code set after +zmsg_send+
|
61
61
|
# returns with failure. Please report as bug.
|
62
62
|
#
|
63
63
|
def send_to(destination)
|
64
|
+
fail ArgumentError, "message has no frames" if size.zero?
|
65
|
+
|
64
66
|
destination.wait_writable
|
65
67
|
|
66
68
|
rc = Zmsg.send(ffi_delegate, destination)
|
@@ -14,7 +14,10 @@ module CZTop
|
|
14
14
|
|
15
15
|
# Waits for a signal.
|
16
16
|
# @return [Integer] the received signal
|
17
|
+
# @note This will block and is therefore not compatible with {Fiber.scheduler} (e.g. Async).
|
17
18
|
def wait
|
19
|
+
fail NotImplementedError if !Fiber.blocking?
|
20
|
+
|
18
21
|
::CZMQ::FFI::Zsock.wait(ffi_delegate)
|
19
22
|
end
|
20
23
|
|
data/lib/cztop/socket.rb
CHANGED
data/lib/cztop/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cztop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrik Wenger
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: czmq-ffi-gen
|
@@ -190,7 +190,7 @@ homepage: https://rubygems.org/gems/cztop
|
|
190
190
|
licenses:
|
191
191
|
- ISC
|
192
192
|
metadata:
|
193
|
-
homepage_uri: https://
|
193
|
+
homepage_uri: https://github.com/paddor/cztop
|
194
194
|
source_code_uri: https://github.com/paddor/cztop
|
195
195
|
changelog_uri: https://github.com/paddor/cztop/blob/master/CHANGES.md
|
196
196
|
post_install_message:
|