cztop 0.4.0 → 0.5.0
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/.travis.yml +5 -4
- data/CHANGES.md +9 -0
- data/Gemfile +3 -0
- data/README.md +7 -4
- data/ci-scripts/install-deps +1 -1
- data/examples/weather_pub_sub/pub.rb +24 -0
- data/examples/weather_pub_sub/sub.rb +33 -0
- data/lib/cztop/version.rb +1 -1
- data/lib/cztop/z85/pipe.rb +0 -1
- data/lib/cztop/zsock_options.rb +17 -8
- data/perf/README.md +2 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96f2495047d3a6101b3dd40b8b840609e524d110
|
4
|
+
data.tar.gz: 4784cc4fc2f0334d2eb8dc59db6a703ad6807478
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cad245ae10e5925122107b97d304df4b1ff0ab7835aeb3d64ac4a558c37b0ad4db323d4ab7ce38b9241f920f5e793cd2497decee16318c3855d00865d43d4d9
|
7
|
+
data.tar.gz: b61227b5ffc632697054b96d65480cc16bc9a05a42d275b6890d0248811d73aff84c10c3ab75bb55239f4b4aa08edfb157f86f789e4edcf3f7ab44308c9573ce
|
data/.travis.yml
CHANGED
@@ -5,15 +5,16 @@ cache:
|
|
5
5
|
- $HOME/.ccache
|
6
6
|
- $HOME/.bundle
|
7
7
|
rvm:
|
8
|
-
- 2.3.
|
9
|
-
- 2.2.
|
10
|
-
- 2.1.8
|
11
|
-
- 2.0.0-p648
|
8
|
+
- 2.3.1
|
9
|
+
- 2.2.5
|
12
10
|
- jruby-head
|
13
11
|
- rbx
|
14
12
|
env:
|
15
13
|
# recognized by czmq-ffi-gen's ci-scripts
|
16
14
|
- CZMQ_VERSION=HEAD ZMQ_VERSION=HEAD
|
15
|
+
matrix:
|
16
|
+
allow_failures:
|
17
|
+
- rvm: rbx
|
17
18
|
before_install:
|
18
19
|
- PATH="/usr/lib/ccache:$PATH" # enable ccache
|
19
20
|
- export LD_LIBRARY_PATH=$HOME/lib # custom libs (for execution)
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
0.5.0 (28/06/2016)
|
2
|
+
-----
|
3
|
+
* new example (weather PUB/SUB)
|
4
|
+
* add option to enable IPv6 on sockets
|
5
|
+
* avoid $DEBUG warnings
|
6
|
+
* fix specs on Rubinius
|
7
|
+
* better documentation
|
8
|
+
* minor CI improvements
|
9
|
+
|
1
10
|
0.4.0 (13/04/2016)
|
2
11
|
-----
|
3
12
|
* CZTop::Poller learns the following methods for convenience and compatibility:
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -57,7 +57,7 @@ Here are some some of the goals I have/had in mind for this library:
|
|
57
57
|
- [x] 100% test coverage
|
58
58
|
- [x] provide a portable Z85 implementation
|
59
59
|
* unlike [fpesce/z85](https://github.com/fpesce/z85), which is a C extension
|
60
|
-
- [
|
60
|
+
- [x] use it to replace the [Celluloid::ZMQ](https://github.com/celluloid/celluloid-zmq) part of [Celluloid](https://github.com/celluloid/celluloid)
|
61
61
|
* [celluloid/celluloid-zmq#56](https://github.com/celluloid/celluloid-zmq/issues/56)
|
62
62
|
- [ ] implement some of the missing (CZMQ based) Ruby examples in the [ZMQ Guide](http://zguide.zeromq.org/page:all)
|
63
63
|
|
@@ -124,11 +124,9 @@ More information in the [API documentation](http://www.rubydoc.info/github/paddo
|
|
124
124
|
* there are `#routing_id` and `#routing_id=` on the following classes:
|
125
125
|
* CZTop::Message
|
126
126
|
* CZTop::Frame
|
127
|
-
* requires ZMQ >= 4.2
|
128
127
|
* ZMTP 3.1 heartbeat ready
|
129
128
|
* `socket.options.heartbeat_ivl = 2000`
|
130
129
|
* `socket.options.heartbeat_timeout = 8000`
|
131
|
-
* requires ZMQ >= 4.2
|
132
130
|
|
133
131
|
## Requirements
|
134
132
|
|
@@ -150,6 +148,11 @@ To install on OSX using homebrew, run:
|
|
150
148
|
If you're running Linux, go check [this page](http://zeromq.org/distro:_start)
|
151
149
|
to get more help. Make sure to install CZMQ, not only ZMQ.
|
152
150
|
|
151
|
+
**Note:** Currently (as of May 2016), when compiling ZMQ from master, it may
|
152
|
+
be required to pass `--enable-drafts` to `./configure` to make sure all the
|
153
|
+
`zmq_poller_*()` functions are available. However, this doesn't seem to be the
|
154
|
+
case on all systems.
|
155
|
+
|
153
156
|
### Supported Ruby versions
|
154
157
|
|
155
158
|
See [.travis.yml](https://github.com/paddor/cztop/blob/master/.travis.yml) for a list of Ruby versions against which CZTop
|
@@ -157,7 +160,7 @@ is tested.
|
|
157
160
|
|
158
161
|
At the time of writing, these include:
|
159
162
|
|
160
|
-
* MRI (2.3, 2.2
|
163
|
+
* MRI (2.3, 2.2)
|
161
164
|
* Rubinius (HEAD)
|
162
165
|
* JRuby 9000 (HEAD)
|
163
166
|
|
data/ci-scripts/install-deps
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Weather update server, based on ZMQ's zguide.
|
4
|
+
# Binds PUB socket to ipc:///tmp/weather_pubsub_example
|
5
|
+
# Publishes random weather updates
|
6
|
+
#
|
7
|
+
|
8
|
+
require 'cztop'
|
9
|
+
|
10
|
+
# create and bind socket
|
11
|
+
socket = CZTop::Socket::PUB.new("ipc:///tmp/weather_pubsub_example")
|
12
|
+
puts "<<< Socket bound to #{socket.last_endpoint.inspect}"
|
13
|
+
|
14
|
+
while true
|
15
|
+
# Generate values for zipcodes
|
16
|
+
zipcode = rand(100000)
|
17
|
+
temperature = rand(215) - 80
|
18
|
+
relhumidity = rand(50) + 10
|
19
|
+
|
20
|
+
update = "%05d %d %d" % [zipcode, temperature, relhumidity]
|
21
|
+
puts update
|
22
|
+
|
23
|
+
socket << update
|
24
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Weather update client, based on that from ZMQ's zguide.
|
4
|
+
# Connects SUB socket to ipc:///tmp/weather_pubsub_example
|
5
|
+
# Collects weather updates and finds avg temp in zipcode
|
6
|
+
#
|
7
|
+
|
8
|
+
require 'cztop'
|
9
|
+
|
10
|
+
COUNT = 100
|
11
|
+
|
12
|
+
# Create socket, connect to publisher.
|
13
|
+
socket = CZTop::Socket::SUB.new("ipc:///tmp/weather_pubsub_example")
|
14
|
+
puts ">>> Socket Connected"
|
15
|
+
|
16
|
+
# Subscribe to zipcode. Default: Chicago - 60606
|
17
|
+
filter = ARGV.size > 0 ? ARGV[0] : "60606"
|
18
|
+
socket.subscribe(filter)
|
19
|
+
|
20
|
+
# gather & process COUNT updates.
|
21
|
+
print "Gathering #{COUNT} samples."
|
22
|
+
total_temp = 0
|
23
|
+
1.upto(COUNT) do |update_nbr|
|
24
|
+
msg = socket.receive
|
25
|
+
|
26
|
+
zipcode, temperature, relhumidity = msg[0].split.map(&:to_i)
|
27
|
+
total_temp += temperature
|
28
|
+
# just to show that we're doing something...
|
29
|
+
print "." if update_nbr % 5 == 0
|
30
|
+
end
|
31
|
+
print "\n"
|
32
|
+
|
33
|
+
puts "Average temperatuer for zipcode #{filter} was #{total_temp / COUNT}F."
|
data/lib/cztop/version.rb
CHANGED
data/lib/cztop/z85/pipe.rb
CHANGED
data/lib/cztop/zsock_options.rb
CHANGED
@@ -32,10 +32,10 @@ module CZTop
|
|
32
32
|
# @raise [NoMethodError] if option name can't be recognized
|
33
33
|
def [](option_name)
|
34
34
|
# NOTE: beware of predicates, especially #CURVE_server? & friends
|
35
|
-
|
35
|
+
meth = public_methods.reject { |m| m =~ /=$/ }
|
36
36
|
.find { |m| m =~ /^#{option_name}\??$/i }
|
37
|
-
raise NoMethodError, option_name if
|
38
|
-
__send__(
|
37
|
+
raise NoMethodError, option_name if meth.nil?
|
38
|
+
__send__(meth)
|
39
39
|
end
|
40
40
|
|
41
41
|
# Fuzzy option setter. This is to make it easier when porting
|
@@ -44,9 +44,9 @@ module CZTop
|
|
44
44
|
# @param new_value [String, Integer] new value
|
45
45
|
# @raise [NoMethodError] if option name can't be recognized
|
46
46
|
def []=(option_name, new_value)
|
47
|
-
|
48
|
-
raise NoMethodError, option_name if
|
49
|
-
__send__(
|
47
|
+
meth = public_methods.find { |m| m =~ /^#{option_name}=$/i }
|
48
|
+
raise NoMethodError, option_name if meth.nil?
|
49
|
+
__send__(meth, new_value)
|
50
50
|
end
|
51
51
|
|
52
52
|
include CZMQ::FFI
|
@@ -273,13 +273,23 @@ module CZTop
|
|
273
273
|
Zsock.set_linger(@zocket, new_value)
|
274
274
|
end
|
275
275
|
|
276
|
+
# @return [Boolean] current value of ipv6
|
277
|
+
def ipv6?() Zsock.ipv6(@zocket) != 0 end
|
278
|
+
# Set the IPv6 option for the socket. A value of true means IPv6 is
|
279
|
+
# enabled on the socket, while false means the socket will use only
|
280
|
+
# IPv4. When IPv6 is enabled the socket will connect to, or accept
|
281
|
+
# connections from, both IPv4 and IPv6 hosts.
|
282
|
+
# Default is false.
|
283
|
+
# @param new_value [Boolean] new value for ipv6
|
284
|
+
def ipv6=(new_value)
|
285
|
+
Zsock.set_ipv6(@zocket, new_value ? 1 : 0)
|
286
|
+
end
|
276
287
|
# TODO: a reasonable subset of these
|
277
288
|
#// Get socket options
|
278
289
|
#int zsock_gssapi_server (void *self);
|
279
290
|
#int zsock_gssapi_plaintext (void *self);
|
280
291
|
#char * zsock_gssapi_principal (void *self);
|
281
292
|
#char * zsock_gssapi_service_principal (void *self);
|
282
|
-
#int zsock_ipv6 (void *self);
|
283
293
|
#int zsock_immediate (void *self);
|
284
294
|
#int zsock_type (void *self);
|
285
295
|
#int zsock_affinity (void *self);
|
@@ -311,7 +321,6 @@ module CZTop
|
|
311
321
|
#void zsock_set_gssapi_plaintext (void *self, int gssapi_plaintext);
|
312
322
|
#void zsock_set_gssapi_principal (void *self, const char * gssapi_principal);
|
313
323
|
#void zsock_set_gssapi_service_principal (void *self, const char * gssapi_service_principal);
|
314
|
-
#void zsock_set_ipv6 (void *self, int ipv6);
|
315
324
|
#void zsock_set_immediate (void *self, int immediate);
|
316
325
|
#void zsock_set_delay_attach_on_connect (void *self, int delay_attach_on_connect);
|
317
326
|
#void zsock_set_affinity (void *self, int affinity);
|
data/perf/README.md
CHANGED
@@ -4,8 +4,8 @@ This directory contains simple performance measurement utilities:
|
|
4
4
|
|
5
5
|
- `inproc_lat.rb` measures the latency of the inproc transport
|
6
6
|
- `inproc_thr.rb` measures the throughput of the inproc transport
|
7
|
-
- `local_lat.rb` and `remote_lat.rb` measure the latency other transports
|
8
|
-
- `local_thr.rb` and `remote_thr.rb` measure the throughput other transports (TODO)
|
7
|
+
- `local_lat.rb` and `remote_lat.rb` measure the latency of other transports
|
8
|
+
- `local_thr.rb` and `remote_thr.rb` measure the throughput of other transports (TODO)
|
9
9
|
|
10
10
|
## Example Output
|
11
11
|
|
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.5.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: 2016-
|
11
|
+
date: 2016-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: czmq-ffi-gen
|
@@ -243,6 +243,8 @@ files:
|
|
243
243
|
- examples/taxi_system/generate_keys.rb
|
244
244
|
- examples/taxi_system/start_broker.sh
|
245
245
|
- examples/taxi_system/start_clients.sh
|
246
|
+
- examples/weather_pub_sub/pub.rb
|
247
|
+
- examples/weather_pub_sub/sub.rb
|
246
248
|
- exe/z85decode
|
247
249
|
- exe/z85encode
|
248
250
|
- lib/cztop.rb
|