cztop 0.12.2 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +12 -0
- data/cztop.gemspec +1 -1
- data/lib/cztop/frame.rb +3 -3
- data/lib/cztop/message.rb +10 -1
- data/lib/cztop/monitor.rb +19 -5
- data/lib/cztop/version.rb +1 -1
- data/lib/cztop/zsock_options.rb +21 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ad5ff197b11908dc2757c0ee6a838d6eba71a80
|
4
|
+
data.tar.gz: 9ea6a9d22790c08ca8127a8ee368ee04eed40c17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6024fe538a43ee3da235d86e9eda9ba64bbef99097b509acc14cbc49c4a5d913ea6f467ef1b01669af2b17c272d8fdf7e5a7c2d51743a616d23e272ce1cfecfa
|
7
|
+
data.tar.gz: 1319974428aeab272139a6833cfacc9d8fc141f2974c24b978877835b96e7176cb23f9330c36eeb17b1e75850ae1c483db7e1a481e50bb74ae913644a06d20de
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
0.13.0 (03/04/2018)
|
2
|
+
-----
|
3
|
+
* use czmq-ffi-gen 0.15.x
|
4
|
+
* CZTop::Monitor#listen: removed HANDSHAKE_FAILED and HANDSHAKE_SUCCEED events
|
5
|
+
and added HANDSHAKE_SUCCEEDED, HANDSHAKE_FAILED_NO_DETAIL,
|
6
|
+
HANDSHAKE:FAILED_PROTOCOL, HANDSHAKE_FAILED_AUTH to reflect changes in CZMQ
|
7
|
+
* add CZTop::Monitor#fd and #readable?
|
8
|
+
* add CZTop::ZsockOptions#fd (so #fd can be called on Sockets and Actors directly)
|
9
|
+
* CZTop::Message#to_a: create less intermediate objects
|
10
|
+
* support ZMQ_RECONNECT_IVL option
|
11
|
+
* CZTop::Frame#group: return nil if group string is empty
|
12
|
+
|
1
13
|
0.12.2 (11/24/2017)
|
2
14
|
-----
|
3
15
|
* no changes, but this release includes an up-to-date version of this file
|
data/cztop.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_runtime_dependency "czmq-ffi-gen", "~> 0.
|
21
|
+
spec.add_runtime_dependency "czmq-ffi-gen", "~> 0.15.0"
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.10"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/lib/cztop/frame.rb
CHANGED
@@ -156,13 +156,13 @@ module CZTop
|
|
156
156
|
end
|
157
157
|
|
158
158
|
# Gets the group (radio/dish pattern).
|
159
|
-
# @note This only set when the frame has been read from
|
159
|
+
# @note This is only set when the frame has been read from
|
160
160
|
# a {CZTop::Socket::DISH} socket.
|
161
161
|
# @return [String] the group
|
162
162
|
# @return [nil] when no group has been set
|
163
163
|
def group
|
164
164
|
group = ffi_delegate.group
|
165
|
-
return nil if group.empty?
|
165
|
+
return nil if group.nil? || group.empty?
|
166
166
|
group
|
167
167
|
end
|
168
168
|
|
@@ -174,7 +174,7 @@ module CZTop
|
|
174
174
|
# @return [new_group]
|
175
175
|
def group=(new_group)
|
176
176
|
rc = ffi_delegate.set_group(new_group)
|
177
|
-
raise_zmq_err("unable to set group to %p" %
|
177
|
+
raise_zmq_err("unable to set group to %p" % new_group) if rc == -1
|
178
178
|
end
|
179
179
|
end
|
180
180
|
end
|
data/lib/cztop/message.rb
CHANGED
@@ -142,7 +142,16 @@ module CZTop
|
|
142
142
|
# strings. This can be a problem if the message is huge/has huge frames.
|
143
143
|
# @return [Array<String>] all frames
|
144
144
|
def to_a
|
145
|
-
|
145
|
+
ffi_delegate = ffi_delegate()
|
146
|
+
frame = ffi_delegate.first
|
147
|
+
return [] if frame.null?
|
148
|
+
|
149
|
+
arr = [ frame.data.read_bytes(frame.size) ]
|
150
|
+
while frame = ffi_delegate.next and not frame.null?
|
151
|
+
arr << frame.data.read_bytes(frame.size)
|
152
|
+
end
|
153
|
+
|
154
|
+
return arr
|
146
155
|
end
|
147
156
|
|
148
157
|
# Inspects this {Message}.
|
data/lib/cztop/monitor.rb
CHANGED
@@ -39,6 +39,7 @@ module CZTop
|
|
39
39
|
|
40
40
|
# @return [Array<String>] types of valid events
|
41
41
|
EVENTS = %w[
|
42
|
+
ALL
|
42
43
|
CONNECTED
|
43
44
|
CONNECT_DELAYED
|
44
45
|
CONNECT_RETRIED
|
@@ -50,9 +51,10 @@ module CZTop
|
|
50
51
|
CLOSE_FAILED
|
51
52
|
DISCONNECTED
|
52
53
|
MONITOR_STOPPED
|
53
|
-
|
54
|
-
|
55
|
-
|
54
|
+
HANDSHAKE_SUCCEEDED
|
55
|
+
HANDSHAKE_FAILED_NO_DETAIL
|
56
|
+
HANDSHAKE_FAILED_PROTOCOL
|
57
|
+
HANDSHAKE_FAILED_AUTH
|
56
58
|
]
|
57
59
|
|
58
60
|
# Configure monitor to listen for specific events.
|
@@ -73,6 +75,18 @@ module CZTop
|
|
73
75
|
@actor.wait
|
74
76
|
end
|
75
77
|
|
78
|
+
# Useful for registration in an event-loop.
|
79
|
+
# @return [Integer] the FD
|
80
|
+
# @see ZsockOptions#fd
|
81
|
+
def fd
|
82
|
+
@actor.fd
|
83
|
+
end
|
84
|
+
|
85
|
+
# @return [Boolean] whether there's at least one event available
|
86
|
+
def readable?
|
87
|
+
@actor.readable?
|
88
|
+
end
|
89
|
+
|
76
90
|
# Get next event. This blocks until the next event is available.
|
77
91
|
# @example
|
78
92
|
# socket = CZTop::Socket::ROUTER.new("tcp://127.0.0.1:5050")
|
@@ -93,8 +107,8 @@ module CZTop
|
|
93
107
|
# end
|
94
108
|
# end
|
95
109
|
#
|
96
|
-
# @return [
|
97
|
-
# <tt>["ACCEPTED", "73", "tcp://127.0.0.1:55585"]</tt>
|
110
|
+
# @return [Message] one of the events from (after {#to_a} it's something like
|
111
|
+
# <tt>["ACCEPTED", "73", "tcp://127.0.0.1:55585"]</tt>)
|
98
112
|
def next
|
99
113
|
@actor.receive
|
100
114
|
end
|
data/lib/cztop/version.rb
CHANGED
data/lib/cztop/zsock_options.rb
CHANGED
@@ -29,6 +29,13 @@ module CZTop
|
|
29
29
|
(options.events & Poller::ZMQ::POLLOUT) > 0
|
30
30
|
end
|
31
31
|
|
32
|
+
# Useful for registration in an event-loop.
|
33
|
+
# @return [Integer]
|
34
|
+
# @see OptionsAccessor#fd
|
35
|
+
def fd
|
36
|
+
options.fd
|
37
|
+
end
|
38
|
+
|
32
39
|
# Used to access the options of a {Socket} or {Actor}.
|
33
40
|
class OptionsAccessor
|
34
41
|
# @return [Socket, Actor] whose options this {OptionsAccessor} instance
|
@@ -312,6 +319,20 @@ module CZTop
|
|
312
319
|
# @see CZTop::Poller::ZMQ::POLLIN and CZTop::Poller::ZMQ::POLLOUT
|
313
320
|
def events() Zsock.events(@zocket) end
|
314
321
|
|
322
|
+
# @return [Integer] current value of RECONNECT_IVL
|
323
|
+
def reconnect_ivl() Zsock.reconnect_ivl(@zocket) end
|
324
|
+
# This defines the number of milliseconds to wait while
|
325
|
+
# closing/disconnecting a socket if there are outstanding messages to
|
326
|
+
# send.
|
327
|
+
#
|
328
|
+
# Default is 0, which means to not wait at all. -1 means to wait
|
329
|
+
# indefinitely
|
330
|
+
#
|
331
|
+
# @param new_value [Integer] new value for RECONNECT_IVL
|
332
|
+
def reconnect_ivl=(new_value)
|
333
|
+
Zsock.set_reconnect_ivl(@zocket, new_value)
|
334
|
+
end
|
335
|
+
|
315
336
|
# TODO: a reasonable subset of these
|
316
337
|
#// Get socket options
|
317
338
|
#int zsock_gssapi_server (void *self);
|
@@ -325,7 +346,6 @@ module CZTop
|
|
325
346
|
#int zsock_recovery_ivl (void *self);
|
326
347
|
#int zsock_sndbuf (void *self);
|
327
348
|
#int zsock_rcvbuf (void *self);
|
328
|
-
#int zsock_reconnect_ivl (void *self);
|
329
349
|
#int zsock_reconnect_ivl_max (void *self);
|
330
350
|
#int zsock_backlog (void *self);
|
331
351
|
#int zsock_maxmsgsize (void *self);
|
@@ -366,7 +386,6 @@ module CZTop
|
|
366
386
|
#void zsock_set_recovery_ivl (void *self, int recovery_ivl);
|
367
387
|
#void zsock_set_sndbuf (void *self, int sndbuf);
|
368
388
|
#void zsock_set_rcvbuf (void *self, int rcvbuf);
|
369
|
-
#void zsock_set_reconnect_ivl (void *self, int reconnect_ivl);
|
370
389
|
#void zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max);
|
371
390
|
#void zsock_set_backlog (void *self, int backlog);
|
372
391
|
#void zsock_set_maxmsgsize (void *self, int maxmsgsize);
|
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: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrik Wenger
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: czmq-ffi-gen
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.15.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.15.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|