cztop 1.2.6 → 1.3.1
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/CHANGES.md +14 -0
- data/README.md +2 -1
- data/cztop.gemspec +2 -1
- data/lib/cztop/poller/zmq.rb +15 -5
- data/lib/cztop/send_receive_methods.rb +19 -5
- data/lib/cztop/version.rb +1 -1
- metadata +23 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1347b002694da386afc7249ac227de7ee7f1224bb140564334b20d646336e73a
|
4
|
+
data.tar.gz: faa02a6ba73af47cbff6af9664562e41d359ba4f13eb5813d6e1e5fc992b6aa8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd22665b89635d5f5a6bbd8326a1de9c13f77a39a253a07316089d9124ec18dadebc67f86b5ec471cc3e09cb0eb6c32d027ad523573fc2b8e502c37b05119cc2
|
7
|
+
data.tar.gz: 1de1565a9d4656e9887958befb29ea0cad66ad90f30d84244f3f60bbcc7069a0cfc20bb1be1c8ff06db34e02546ca9ff8349c01689faa1725e6f8cb069e846db
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
1.3.2 (1/3/2025)
|
2
|
+
-----
|
3
|
+
* add 'benchmark' dependency for specs
|
4
|
+
|
5
|
+
1.3.1 (1/3/2025)
|
6
|
+
-----
|
7
|
+
* find libzmq in /usr/lib and respect LD_LIBRARY_PATH
|
8
|
+
* relax dependency to allow czmq-ffi-gen 1.x
|
9
|
+
|
10
|
+
1.2.7 (7/12/2024)
|
11
|
+
-----
|
12
|
+
* CZTop::Socket#wait_readable: honor small (< 0.5s) timeouts
|
13
|
+
* CZTop::Socket#wait_writable: honor small (< 0.5s) timeouts
|
14
|
+
|
1
15
|
1.2.6 (7/12/2024)
|
2
16
|
-----
|
3
17
|
* add missing `require 'io/wait'` to get `IO#wait_readable`
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|

|
2
|
-

|
2
|
+

|
3
|
+

|
3
4
|
[](https://codecov.io/gh/paddor/cztop)
|
4
5
|
|
5
6
|
# CZTop
|
data/cztop.gemspec
CHANGED
@@ -23,9 +23,10 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = ["lib"]
|
25
25
|
|
26
|
-
spec.add_runtime_dependency "czmq-ffi-gen", "~> 1.1.0"
|
26
|
+
spec.add_runtime_dependency "czmq-ffi-gen", "~> 1.1", ">= 1.1.0"
|
27
27
|
|
28
28
|
spec.add_development_dependency "bundler"
|
29
|
+
spec.add_development_dependency "benchmark"
|
29
30
|
spec.add_development_dependency "rake"
|
30
31
|
spec.add_development_dependency "rspec"
|
31
32
|
spec.add_development_dependency "minitest"
|
data/lib/cztop/poller/zmq.rb
CHANGED
@@ -9,11 +9,21 @@ module CZTop
|
|
9
9
|
POLLERR = 4
|
10
10
|
|
11
11
|
extend ::FFI::Library
|
12
|
-
lib_name
|
13
|
-
|
14
|
-
lib_dirs
|
15
|
-
|
16
|
-
|
12
|
+
lib_name = 'libzmq'
|
13
|
+
major_version = '5'
|
14
|
+
lib_dirs = ['/usr/local/lib', '/opt/local/lib', '/usr/lib64', '/usr/lib']
|
15
|
+
lib_dirs = [*ENV['LD_LIBRARY_PATH'].split(':'), *lib_dirs] if ENV['LD_LIBRARY_PATH']
|
16
|
+
lib_dirs = [*ENV["#{lib_name.upcase}_PATH"].split(':'), *lib_dirs] if ENV["#{lib_name.upcase}_PATH"]
|
17
|
+
lib_paths = lib_dirs.map do |path|
|
18
|
+
[
|
19
|
+
"#{path}/#{lib_name}.#{::FFI::Platform::LIBSUFFIX}",
|
20
|
+
"#{path}/#{lib_name}.#{::FFI::Platform::LIBSUFFIX}.#{major_version}"
|
21
|
+
]
|
22
|
+
end.flatten
|
23
|
+
|
24
|
+
lib_paths.concat [lib_name, "#{lib_name}.#{::FFI::Platform::LIBSUFFIX}.#{major_version}"]
|
25
|
+
|
26
|
+
ffi_lib lib_paths
|
17
27
|
|
18
28
|
# This represents a +zmq_poller_event_t+ as in:
|
19
29
|
#
|
@@ -48,15 +48,29 @@ module CZTop
|
|
48
48
|
|
49
49
|
|
50
50
|
# Because ZMQ sockets are edge-triggered, there's a small chance that we miss an edge (race condition). To avoid
|
51
|
-
# blocking forever, all waiting on the ZMQ FD is done with this timeout.
|
51
|
+
# blocking forever, all waiting on the ZMQ FD is done with this timeout or less.
|
52
|
+
#
|
53
|
+
# The race condition exists between the calls to {#readable?}/{#writable?} and waiting for the ZMQ FD. If the
|
54
|
+
# socke becomes readable/writable during that time, waiting for the FD could block forever without a timeout.
|
55
|
+
#
|
52
56
|
FD_TIMEOUT = 0.5
|
53
57
|
|
54
58
|
|
55
59
|
# @note Only available on Ruby >= 3.2
|
56
60
|
#
|
57
|
-
def wait_for_fd_signal
|
61
|
+
def wait_for_fd_signal(timeout = nil)
|
58
62
|
@fd_io ||= to_io
|
59
|
-
|
63
|
+
|
64
|
+
if timeout
|
65
|
+
if timeout > FD_TIMEOUT
|
66
|
+
timeout = FD_TIMEOUT
|
67
|
+
end
|
68
|
+
else
|
69
|
+
timeout = FD_TIMEOUT
|
70
|
+
end
|
71
|
+
|
72
|
+
# NOTE: always wait for readability on ZMQ FD
|
73
|
+
@fd_io.wait_readable timeout
|
60
74
|
end if IO.method_defined?(:wait_readable)
|
61
75
|
|
62
76
|
|
@@ -80,7 +94,7 @@ module CZTop
|
|
80
94
|
while true
|
81
95
|
# p wait_readable: self, timeout: timeout
|
82
96
|
|
83
|
-
wait_for_fd_signal
|
97
|
+
wait_for_fd_signal timeout
|
84
98
|
break if readable? # NOTE: ZMQ FD can't be trusted
|
85
99
|
raise ::IO::TimeoutError if timeout_at && now >= timeout_at
|
86
100
|
|
@@ -107,7 +121,7 @@ module CZTop
|
|
107
121
|
while true
|
108
122
|
# p wait_writable: self, timeout: timeout
|
109
123
|
|
110
|
-
wait_for_fd_signal
|
124
|
+
wait_for_fd_signal timeout
|
111
125
|
break if writable? # NOTE: ZMQ FD can't be trusted
|
112
126
|
raise ::IO::TimeoutError if timeout_at && now >= timeout_at
|
113
127
|
|
data/lib/cztop/version.rb
CHANGED
metadata
CHANGED
@@ -1,20 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cztop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrik Wenger
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-01-03 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: czmq-ffi-gen
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
16
|
- - "~>"
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '1.1'
|
19
|
+
- - ">="
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: 1.1.0
|
20
22
|
type: :runtime
|
@@ -22,6 +24,9 @@ dependencies:
|
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
23
25
|
requirements:
|
24
26
|
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '1.1'
|
29
|
+
- - ">="
|
25
30
|
- !ruby/object:Gem::Version
|
26
31
|
version: 1.1.0
|
27
32
|
- !ruby/object:Gem::Dependency
|
@@ -38,6 +43,20 @@ dependencies:
|
|
38
43
|
- - ">="
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: benchmark
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
type: :development
|
54
|
+
prerelease: false
|
55
|
+
version_requirements: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
41
60
|
- !ruby/object:Gem::Dependency
|
42
61
|
name: rake
|
43
62
|
requirement: !ruby/object:Gem::Requirement
|
@@ -194,7 +213,6 @@ metadata:
|
|
194
213
|
homepage_uri: https://github.com/paddor/cztop
|
195
214
|
source_code_uri: https://github.com/paddor/cztop
|
196
215
|
changelog_uri: https://github.com/paddor/cztop/blob/master/CHANGES.md
|
197
|
-
post_install_message:
|
198
216
|
rdoc_options: []
|
199
217
|
require_paths:
|
200
218
|
- lib
|
@@ -209,8 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
227
|
- !ruby/object:Gem::Version
|
210
228
|
version: '0'
|
211
229
|
requirements: []
|
212
|
-
rubygems_version: 3.
|
213
|
-
signing_key:
|
230
|
+
rubygems_version: 3.6.2
|
214
231
|
specification_version: 4
|
215
232
|
summary: CZMQ FFI binding to bring ZMQ sockets to Ruby
|
216
233
|
test_files: []
|