omq-cli 0.15.3 → 0.16.3
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/CHANGELOG.md +41 -2
- data/README.md +34 -11
- data/lib/omq/cli/cli_parser.rb +4 -4
- data/lib/omq/cli/formatter.rb +12 -11
- data/lib/omq/cli/parallel_worker.rb +1 -2
- data/lib/omq/cli/pipe.rb +38 -17
- data/lib/omq/cli/pipe_worker.rb +2 -4
- data/lib/omq/cli/socket_setup.rb +28 -36
- data/lib/omq/cli/version.rb +1 -1
- data/lib/omq/cli.rb +6 -6
- metadata +15 -79
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7e84392abf886c286b4bed1b1c18a59db92c3b7e945b7d8712e78b6a8ce45cd4
|
|
4
|
+
data.tar.gz: 13f177c5d2354cfd67b42847c9f6d212fb271199666192177b197f0ae642d793
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9d74335164a1d5bc2101c8abb2b77d1bef6d8e8d2aa845ee5a2ea0b456114c936ae91bc1a8a52f5cce6e109e2a63d0f42f9d3551ecdc94153e7c9e513e33408b
|
|
7
|
+
data.tar.gz: 33f0358e3dfabbf5670816c63a078e1f3a27f4040595c9393ec4a0710a59999ddc16532bb73341b2a8c91051a251b62ad213db3dae3f0b868677025c4fc61742
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.16.4 — 2026-04-20
|
|
4
|
+
|
|
5
|
+
- **Use omq ~> v0.26.2
|
|
6
|
+
|
|
7
|
+
## 0.16.3 — 2026-04-20
|
|
8
|
+
|
|
9
|
+
- **Use omq ~> v0.26.1
|
|
10
|
+
|
|
11
|
+
## 0.16.2 — 2026-04-18
|
|
12
|
+
|
|
13
|
+
- **Use omq ~> v0.24.0 and omq-ffi >= v0.3.1**
|
|
14
|
+
|
|
15
|
+
## 0.16.1 — 2026-04-18
|
|
16
|
+
|
|
17
|
+
- **Use zstd ~> v0.4.0**
|
|
18
|
+
|
|
19
|
+
## 0.16.0 — 2026-04-18
|
|
20
|
+
|
|
21
|
+
- **Compression: switch from `OMQ::Compression::Zstd` helpers to the
|
|
22
|
+
`zstd+tcp://` transport.** `-z` now upgrades `tcp://` URLs to
|
|
23
|
+
`zstd+tcp://` and passes compression kwargs (`level:`) at bind /
|
|
24
|
+
connect time. Pipe runners and parallel workers take `config:` to
|
|
25
|
+
thread the flag through. Removes the passive/active distinction
|
|
26
|
+
and the pure-send opt-out list — the transport handles framing.
|
|
27
|
+
- **`SocketSetup.attach` / `#attach_endpoints` use URI return values
|
|
28
|
+
from `Socket#bind`.** Drops reliance on the dropped
|
|
29
|
+
`Socket#last_endpoint` accessor (omq 0.12 change). Tests capture
|
|
30
|
+
the resolved URI from `#bind` directly.
|
|
31
|
+
- **Dependencies consolidated.** Drops the five `omq-rfc-*` socket-type
|
|
32
|
+
gems (`clientserver`, `radiodish`, `scattergather`, `channel`, `p2p`)
|
|
33
|
+
— those socket types are now bundled with `omq` itself and opted
|
|
34
|
+
into via `require "omq/<name>"`. Renames `omq-rfc-zstd` → `omq-zstd`
|
|
35
|
+
and switches the require from `omq/rfc/zstd` to `omq/zstd`. Bumps
|
|
36
|
+
`omq` to `~> 0.23` and `omq-ffi` to `~> 0.3`.
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- **Formatter preview: per-frame byte budget scales with part count.**
|
|
41
|
+
Single-part messages show 40 bytes; 2-part show 40 each; 3+ parts
|
|
42
|
+
show 12 bytes per frame (the previous fixed limit).
|
|
43
|
+
|
|
3
44
|
## 0.15.3 — 2026-04-16
|
|
4
45
|
|
|
5
46
|
### Changed
|
|
@@ -8,8 +49,6 @@
|
|
|
8
49
|
`ParallelWorker#compute_reply` now memoize the decoded result
|
|
9
50
|
instead of re-decoding the same literal on every iteration.
|
|
10
51
|
|
|
11
|
-
## Unreleased
|
|
12
|
-
|
|
13
52
|
### Added
|
|
14
53
|
|
|
15
54
|
- **REQ generator mode (`-E`/`-e` with no stdin).** `omq req` now
|
data/README.md
CHANGED
|
@@ -396,22 +396,45 @@ omq pub -c tcp://localhost:5556 -D "tick" -i 1 -n 10 -d 1
|
|
|
396
396
|
omq pull -b tcp://:5557 -t 5
|
|
397
397
|
```
|
|
398
398
|
|
|
399
|
+
## Limits
|
|
400
|
+
|
|
401
|
+
| Flag | Effect |
|
|
402
|
+
|------|--------|
|
|
403
|
+
| `--recv-maxsz SIZE` | Max inbound message size (default `1M`; `0` = unlimited). Larger messages drop the connection. Accepts `4096`, `64K`, `1M`, `2G`. |
|
|
404
|
+
| `--hwm N` | High water mark per socket (default 64; `0` = unbounded) |
|
|
405
|
+
| `--sndbuf SIZE` / `--rcvbuf SIZE` | `SO_SNDBUF` / `SO_RCVBUF` kernel buffer sizes |
|
|
406
|
+
|
|
407
|
+
The CLI defaults `--recv-maxsz` to `1 MiB` so that a misconfigured or
|
|
408
|
+
malicious peer can't force unbounded memory allocation in a terminal
|
|
409
|
+
session — note that the `omq` library itself defaults to unlimited.
|
|
410
|
+
Bump it with `--recv-maxsz 64M` for large payloads, or disable it with
|
|
411
|
+
`--recv-maxsz 0`. When combined with `-z`, this also caps the total
|
|
412
|
+
**decompressed** size of all parts in a `zstd+tcp://` message.
|
|
413
|
+
|
|
399
414
|
## Compression
|
|
400
415
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
416
|
+
`-z` enables Zstandard compression on the wire. It rewrites the
|
|
417
|
+
endpoint's `tcp://` scheme to `zstd+tcp://`, the dedicated compressed
|
|
418
|
+
TCP transport provided by [`omq-zstd`](https://github.com/paddor/omq-zstd).
|
|
419
|
+
Both peers must pass `-z` (or otherwise opt into `zstd+tcp://`).
|
|
420
|
+
|
|
421
|
+
| Flag | Effect |
|
|
422
|
+
|------|--------|
|
|
423
|
+
| `-z` | Compression at level **-3** (Zstd's fast strategy) |
|
|
424
|
+
| `-Z` | Compression at level **3** (better ratio, more CPU) |
|
|
425
|
+
| `--compress=LEVEL` | Custom level, e.g. `9`, `19`, `-1` |
|
|
426
|
+
|
|
427
|
+
The sender auto-trains a dictionary from the first up-to-1000
|
|
428
|
+
outgoing messages (or 100 KiB, whichever hits first), ships it inline
|
|
429
|
+
to the receiver, and then switches to dictionary-bound
|
|
430
|
+
compression for the rest of the connection.
|
|
431
|
+
|
|
432
|
+
`-z` is a no-op for non-TCP endpoints (`ipc://`, `inproc://`); those
|
|
433
|
+
stay unchanged.
|
|
411
434
|
|
|
412
435
|
```sh
|
|
436
|
+
omq pull -b tcp://:5557 -z &
|
|
413
437
|
omq push -c tcp://remote:5557 -z < data.txt
|
|
414
|
-
omq pull -b tcp://:5557 -z
|
|
415
438
|
```
|
|
416
439
|
|
|
417
440
|
## Key generation
|
data/lib/omq/cli/cli_parser.rb
CHANGED
|
@@ -144,10 +144,10 @@ module OMQ
|
|
|
144
144
|
|
|
145
145
|
-- Compression ----------------------------------------------
|
|
146
146
|
|
|
147
|
-
#
|
|
148
|
-
#
|
|
149
|
-
#
|
|
150
|
-
omq pull --bind tcp://:5557 &
|
|
147
|
+
# -z rewrites tcp:// endpoints to zstd+tcp:// (the dedicated
|
|
148
|
+
# compressed TCP transport from omq-zstd). Both peers must
|
|
149
|
+
# pass -z; non-TCP endpoints are unaffected.
|
|
150
|
+
omq pull --bind tcp://:5557 -z &
|
|
151
151
|
echo "compressible data" | omq push --connect tcp://localhost:5557 -z
|
|
152
152
|
|
|
153
153
|
-- CURVE Encryption -----------------------------------------
|
data/lib/omq/cli/formatter.rb
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
module OMQ
|
|
4
4
|
module CLI
|
|
5
5
|
# Handles encoding/decoding messages in the configured format.
|
|
6
|
-
#
|
|
7
|
-
# (omq-rfc-zstd) once enabled via +socket.compression=+; the
|
|
8
|
-
# formatter sees plaintext frames in both directions.
|
|
6
|
+
#
|
|
9
7
|
class Formatter
|
|
10
8
|
# @param format [Symbol] wire format (:ascii, :quoted, :raw, :jsonl, :msgpack, :marshal)
|
|
11
9
|
def initialize(format)
|
|
@@ -93,7 +91,7 @@ module OMQ
|
|
|
93
91
|
|
|
94
92
|
|
|
95
93
|
# Formats message parts for human-readable preview (logging).
|
|
96
|
-
# When +wire_size+ is given (
|
|
94
|
+
# When +wire_size+ is given (`omq-zstd`), the header
|
|
97
95
|
# also shows the compressed on-the-wire size: "(29B wire=12B)".
|
|
98
96
|
# Accepts either wire-side Array<String> (monitor events) or
|
|
99
97
|
# post-decode app parts that may contain non-String objects
|
|
@@ -147,7 +145,9 @@ module OMQ
|
|
|
147
145
|
|
|
148
146
|
def self.frames_preview(parts, format:, wire_size:)
|
|
149
147
|
nparts = parts.size
|
|
150
|
-
|
|
148
|
+
# Budget per frame: fewer parts → more room for each preview.
|
|
149
|
+
limit = nparts <= 2 ? 40 : 12
|
|
150
|
+
shown = parts.first(3).map { |p| preview_frame(p, limit: limit) }
|
|
151
151
|
tail = nparts > 3 ? "|…" : ""
|
|
152
152
|
total = parts.all?(String) ? parts.sum { |p| p.bytesize } : nil
|
|
153
153
|
size = if wire_size && total
|
|
@@ -165,16 +165,17 @@ module OMQ
|
|
|
165
165
|
|
|
166
166
|
|
|
167
167
|
# Renders one frame or decoded object for {Formatter.preview}.
|
|
168
|
-
# Strings are sanitized byte-wise (first
|
|
168
|
+
# Strings are sanitized byte-wise (first +limit+ bytes); non-String
|
|
169
169
|
# objects fall back to #inspect (always single-line) truncated
|
|
170
|
-
# at
|
|
170
|
+
# at +limit+ bytes.
|
|
171
171
|
#
|
|
172
172
|
# @param part [String, Object]
|
|
173
|
+
# @param limit [Integer] max bytes to show (default 12)
|
|
173
174
|
# @return [String]
|
|
174
|
-
def self.preview_frame(part)
|
|
175
|
+
def self.preview_frame(part, limit: 12)
|
|
175
176
|
unless part.is_a?(String)
|
|
176
177
|
s = part.inspect
|
|
177
|
-
return s.bytesize >
|
|
178
|
+
return s.bytesize > limit ? "#{s.byteslice(0, limit)}…" : s
|
|
178
179
|
end
|
|
179
180
|
|
|
180
181
|
bytes = part.b
|
|
@@ -184,12 +185,12 @@ module OMQ
|
|
|
184
185
|
# wire frame is an empty delimiter.
|
|
185
186
|
return "''" if bytes.empty?
|
|
186
187
|
|
|
187
|
-
sample = bytes[0,
|
|
188
|
+
sample = bytes[0, limit]
|
|
188
189
|
printable = sample.count("\x20-\x7e")
|
|
189
190
|
|
|
190
191
|
if printable < sample.bytesize / 2
|
|
191
192
|
"[#{bytes.bytesize}B]"
|
|
192
|
-
elsif bytes.bytesize >
|
|
193
|
+
elsif bytes.bytesize > limit
|
|
193
194
|
"#{sanitize(sample)}…"
|
|
194
195
|
else
|
|
195
196
|
sanitize(sample)
|
|
@@ -51,9 +51,8 @@ module OMQ
|
|
|
51
51
|
@sock = @config.ffi ? OMQ.const_get(@socket_sym).new(backend: :ffi) : OMQ.const_get(@socket_sym).new
|
|
52
52
|
OMQ::CLI::SocketSetup.apply_options(@sock, @config)
|
|
53
53
|
OMQ::CLI::SocketSetup.apply_recv_maxsz(@sock, @config)
|
|
54
|
-
OMQ::CLI::SocketSetup.apply_compression(@sock, @config, @config.type_name)
|
|
55
54
|
@sock.identity = @config.identity if @config.identity
|
|
56
|
-
OMQ::CLI::SocketSetup.attach_endpoints(@sock, @endpoints, verbose: 0)
|
|
55
|
+
OMQ::CLI::SocketSetup.attach_endpoints(@sock, @endpoints, config: @config, verbose: 0)
|
|
57
56
|
end
|
|
58
57
|
|
|
59
58
|
|
data/lib/omq/cli/pipe.rb
CHANGED
|
@@ -84,21 +84,31 @@ module OMQ
|
|
|
84
84
|
|
|
85
85
|
def build_pull_push(in_eps, out_eps)
|
|
86
86
|
kwargs = config.ffi ? { backend: :ffi } : {}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
87
|
+
|
|
88
|
+
pull = OMQ::PULL.new(**kwargs).tap do |sock|
|
|
89
|
+
SocketSetup.apply_options(sock, config)
|
|
90
|
+
SocketSetup.apply_recv_maxsz(sock, config)
|
|
91
|
+
SocketSetup.attach_endpoints sock, in_eps,
|
|
92
|
+
config: config,
|
|
93
|
+
verbose: config.verbose,
|
|
94
|
+
timestamps: config.timestamps
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
push = OMQ::PUSH.new(**kwargs).tap do |sock|
|
|
98
|
+
SocketSetup.apply_options(sock, config)
|
|
99
|
+
SocketSetup.attach_endpoints sock, out_eps,
|
|
100
|
+
config: config,
|
|
101
|
+
verbose: config.verbose,
|
|
102
|
+
timestamps: config.timestamps
|
|
103
|
+
end
|
|
104
|
+
|
|
96
105
|
[pull, push]
|
|
97
106
|
end
|
|
98
107
|
|
|
99
108
|
|
|
100
109
|
def setup_sequential_transient(task)
|
|
101
110
|
return unless config.transient
|
|
111
|
+
|
|
102
112
|
task.async do
|
|
103
113
|
@pull.all_peers_gone.wait
|
|
104
114
|
@pull.reconnect_enabled = false
|
|
@@ -110,21 +120,27 @@ module OMQ
|
|
|
110
120
|
def sequential_message_loop(fan_out: false)
|
|
111
121
|
n = config.count
|
|
112
122
|
i = 0
|
|
123
|
+
|
|
113
124
|
loop do
|
|
114
|
-
parts = @pull.receive
|
|
115
|
-
break if parts.nil?
|
|
125
|
+
parts = @pull.receive or break
|
|
116
126
|
parts = eval_recv_expr(parts)
|
|
127
|
+
|
|
117
128
|
if parts && !parts.empty?
|
|
118
129
|
@push.send(parts)
|
|
119
130
|
end
|
|
131
|
+
|
|
120
132
|
# Yield after send so send-pump fibers can drain the queue
|
|
121
133
|
# before the next message is enqueued. Without this, one pump
|
|
122
134
|
# monopolizes the shared queue via drain_send_queue_capped when
|
|
123
135
|
# messages arrive in bursts (recv prefetch). Only needed for
|
|
124
136
|
# multi-output pipes; single-output has no fairness concern.
|
|
125
137
|
Async::Task.current.yield if fan_out
|
|
138
|
+
|
|
126
139
|
i += 1
|
|
127
|
-
|
|
140
|
+
|
|
141
|
+
if n && n > 0 && i >= n
|
|
142
|
+
break
|
|
143
|
+
end
|
|
128
144
|
end
|
|
129
145
|
end
|
|
130
146
|
|
|
@@ -135,22 +151,25 @@ module OMQ
|
|
|
135
151
|
def run_parallel(task)
|
|
136
152
|
set_pipe_process_title
|
|
137
153
|
OMQ.freeze_for_ractors!
|
|
138
|
-
|
|
139
|
-
in_eps
|
|
140
|
-
|
|
154
|
+
|
|
155
|
+
in_eps, out_eps = resolve_endpoints
|
|
156
|
+
in_eps = RactorHelpers.preresolve_tcp(in_eps)
|
|
157
|
+
out_eps = RactorHelpers.preresolve_tcp(out_eps)
|
|
141
158
|
log_port, log_thread = RactorHelpers.start_log_consumer
|
|
142
|
-
error_port
|
|
143
|
-
error_thread
|
|
159
|
+
error_port = Ractor::Port.new
|
|
160
|
+
error_thread = Thread.new(error_port) do |p|
|
|
144
161
|
msg = p.receive
|
|
145
162
|
abort "omq: #{msg}" unless msg.equal?(RactorHelpers::SHUTDOWN)
|
|
146
163
|
rescue Ractor::ClosedError
|
|
147
164
|
# port closed, no error
|
|
148
165
|
end
|
|
166
|
+
|
|
149
167
|
workers = config.parallel.times.map do
|
|
150
168
|
::Ractor.new(config, in_eps, out_eps, log_port, error_port) do |cfg, ins, outs, lport, eport|
|
|
151
169
|
PipeWorker.new(cfg, ins, outs, lport, eport).call
|
|
152
170
|
end
|
|
153
171
|
end
|
|
172
|
+
|
|
154
173
|
workers.each do |w|
|
|
155
174
|
w.join
|
|
156
175
|
rescue ::Ractor::RemoteError => e
|
|
@@ -173,6 +192,7 @@ module OMQ
|
|
|
173
192
|
title.concat(in_eps.map(&:url))
|
|
174
193
|
title << "->"
|
|
175
194
|
title.concat(out_eps.map(&:url))
|
|
195
|
+
|
|
176
196
|
Process.setproctitle(title.join(" "))
|
|
177
197
|
end
|
|
178
198
|
|
|
@@ -207,6 +227,7 @@ module OMQ
|
|
|
207
227
|
end
|
|
208
228
|
end
|
|
209
229
|
end
|
|
230
|
+
|
|
210
231
|
end
|
|
211
232
|
end
|
|
212
233
|
end
|
data/lib/omq/cli/pipe_worker.rb
CHANGED
|
@@ -44,10 +44,8 @@ module OMQ
|
|
|
44
44
|
OMQ::CLI::SocketSetup.apply_options(@pull, @config)
|
|
45
45
|
OMQ::CLI::SocketSetup.apply_options(@push, @config)
|
|
46
46
|
OMQ::CLI::SocketSetup.apply_recv_maxsz(@pull, @config)
|
|
47
|
-
OMQ::CLI::SocketSetup.
|
|
48
|
-
OMQ::CLI::SocketSetup.
|
|
49
|
-
OMQ::CLI::SocketSetup.attach_endpoints(@pull, @in_eps, verbose: 0)
|
|
50
|
-
OMQ::CLI::SocketSetup.attach_endpoints(@push, @out_eps, verbose: 0)
|
|
47
|
+
OMQ::CLI::SocketSetup.attach_endpoints(@pull, @in_eps, config: @config, verbose: 0)
|
|
48
|
+
OMQ::CLI::SocketSetup.attach_endpoints(@push, @out_eps, config: @config, verbose: 0)
|
|
51
49
|
end
|
|
52
50
|
|
|
53
51
|
|
data/lib/omq/cli/socket_setup.rb
CHANGED
|
@@ -22,37 +22,23 @@ module OMQ
|
|
|
22
22
|
# it entirely with --recv-maxsz 0.
|
|
23
23
|
DEFAULT_RECV_MAXSZ = 1 << 20
|
|
24
24
|
|
|
25
|
-
#
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
# Upgrades a +tcp://+ URL to +zstd+tcp://+ when compression is enabled.
|
|
26
|
+
# Returns the URL unchanged for non-TCP or when compression is off.
|
|
27
|
+
#
|
|
28
|
+
def self.compress_url(url, config)
|
|
29
|
+
return url unless config.compress
|
|
30
|
+
return url unless url.start_with?("tcp://")
|
|
31
31
|
|
|
32
|
+
url.sub("tcp://", "zstd+tcp://")
|
|
33
|
+
end
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
#
|
|
35
|
-
#
|
|
36
|
-
# * +config.compress+ is true --> active compression (auto-dict).
|
|
37
|
-
# Outgoing frames are compressed; incoming are decoded.
|
|
38
|
-
# * +config.compress+ is false and +type_name+ can receive -->
|
|
39
|
-
# passive compression (RFC Sec. 6.4). The socket advertises the
|
|
40
|
-
# profile so an active peer can compress on the wire and we can
|
|
41
|
-
# decode it, but we never compress our own outgoing frames.
|
|
42
|
-
# * +config.compress+ is false and +type_name+ is in
|
|
43
|
-
# +PURE_SEND_TYPES+ --> no compression. Pure senders have no
|
|
44
|
-
# incoming traffic to decompress, so passive mode is pure
|
|
45
|
-
# overhead on outgoing.
|
|
35
|
+
|
|
36
|
+
# Returns bind/connect kwargs for compression (level:) when enabled.
|
|
46
37
|
#
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if config.compress
|
|
52
|
-
sock.compression = OMQ::Compression::Zstd.auto(level: config.compress_level || -3)
|
|
53
|
-
elsif !PURE_SEND_TYPES.include?(type_name)
|
|
54
|
-
sock.compression = OMQ::Compression::Zstd.auto(passive: true)
|
|
55
|
-
end
|
|
38
|
+
def self.compress_opts(config)
|
|
39
|
+
return {} unless config.compress
|
|
40
|
+
|
|
41
|
+
{ level: config.compress_level || -3 }
|
|
56
42
|
end
|
|
57
43
|
|
|
58
44
|
|
|
@@ -81,7 +67,6 @@ module OMQ
|
|
|
81
67
|
apply_recv_maxsz(sock, config)
|
|
82
68
|
sock.identity = config.identity if config.identity
|
|
83
69
|
sock.router_mandatory = true if config.type_name == "router"
|
|
84
|
-
apply_compression(sock, config, config.type_name)
|
|
85
70
|
sock
|
|
86
71
|
end
|
|
87
72
|
|
|
@@ -101,12 +86,15 @@ module OMQ
|
|
|
101
86
|
# +verbose+ gates logging (>= 1), +timestamps+ controls prefix.
|
|
102
87
|
#
|
|
103
88
|
def self.attach(sock, config, verbose: 0, timestamps: nil)
|
|
89
|
+
opts = compress_opts(config)
|
|
90
|
+
|
|
104
91
|
config.binds.each do |url|
|
|
105
|
-
sock.bind(url)
|
|
106
|
-
CLI::Term.write_attach(:bind,
|
|
92
|
+
uri = sock.bind(compress_url(url, config), **opts)
|
|
93
|
+
CLI::Term.write_attach(:bind, uri.to_s, timestamps) if verbose >= 1
|
|
107
94
|
end
|
|
95
|
+
|
|
108
96
|
config.connects.each do |url|
|
|
109
|
-
sock.connect(url)
|
|
97
|
+
sock.connect(compress_url(url, config), **opts)
|
|
110
98
|
CLI::Term.write_attach(:connect, url, timestamps) if verbose >= 1
|
|
111
99
|
end
|
|
112
100
|
end
|
|
@@ -116,13 +104,17 @@ module OMQ
|
|
|
116
104
|
# Used by PipeRunner, which works with structured endpoint lists.
|
|
117
105
|
# +verbose+ gates logging (>= 1), +timestamps+ controls prefix.
|
|
118
106
|
#
|
|
119
|
-
def self.attach_endpoints(sock, endpoints, verbose: 0, timestamps: nil)
|
|
107
|
+
def self.attach_endpoints(sock, endpoints, config: nil, verbose: 0, timestamps: nil)
|
|
108
|
+
opts = config ? compress_opts(config) : {}
|
|
109
|
+
|
|
120
110
|
endpoints.each do |ep|
|
|
111
|
+
url = config ? compress_url(ep.url, config) : ep.url
|
|
112
|
+
|
|
121
113
|
if ep.bind?
|
|
122
|
-
sock.bind(
|
|
123
|
-
CLI::Term.write_attach(:bind,
|
|
114
|
+
uri = sock.bind(url, **opts)
|
|
115
|
+
CLI::Term.write_attach(:bind, uri.to_s, timestamps) if verbose >= 1
|
|
124
116
|
else
|
|
125
|
-
sock.connect(
|
|
117
|
+
sock.connect(url, **opts)
|
|
126
118
|
CLI::Term.write_attach(:connect, ep.url, timestamps) if verbose >= 1
|
|
127
119
|
end
|
|
128
120
|
end
|
data/lib/omq/cli/version.rb
CHANGED
data/lib/omq/cli.rb
CHANGED
|
@@ -201,12 +201,12 @@ module OMQ
|
|
|
201
201
|
config = build_config(argv)
|
|
202
202
|
|
|
203
203
|
require "omq"
|
|
204
|
-
require "omq/
|
|
205
|
-
require "omq/
|
|
206
|
-
require "omq/
|
|
207
|
-
require "omq/
|
|
208
|
-
require "omq/
|
|
209
|
-
require "omq/
|
|
204
|
+
require "omq/client_server"
|
|
205
|
+
require "omq/radio_dish"
|
|
206
|
+
require "omq/scatter_gather"
|
|
207
|
+
require "omq/channel"
|
|
208
|
+
require "omq/peer"
|
|
209
|
+
require "omq/zstd"
|
|
210
210
|
require "async"
|
|
211
211
|
require "json"
|
|
212
212
|
require "console"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: omq-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.16.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Patrik Wenger
|
|
@@ -15,112 +15,48 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '0.
|
|
19
|
-
|
|
20
|
-
prerelease: false
|
|
21
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
-
requirements:
|
|
23
|
-
- - "~>"
|
|
24
|
-
- !ruby/object:Gem::Version
|
|
25
|
-
version: '0.22'
|
|
26
|
-
- !ruby/object:Gem::Dependency
|
|
27
|
-
name: omq-ffi
|
|
28
|
-
requirement: !ruby/object:Gem::Requirement
|
|
29
|
-
requirements:
|
|
30
|
-
- - "~>"
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: '0.2'
|
|
33
|
-
type: :runtime
|
|
34
|
-
prerelease: false
|
|
35
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
-
requirements:
|
|
37
|
-
- - "~>"
|
|
38
|
-
- !ruby/object:Gem::Version
|
|
39
|
-
version: '0.2'
|
|
40
|
-
- !ruby/object:Gem::Dependency
|
|
41
|
-
name: omq-rfc-clientserver
|
|
42
|
-
requirement: !ruby/object:Gem::Requirement
|
|
43
|
-
requirements:
|
|
44
|
-
- - "~>"
|
|
45
|
-
- !ruby/object:Gem::Version
|
|
46
|
-
version: '0.2'
|
|
47
|
-
type: :runtime
|
|
48
|
-
prerelease: false
|
|
49
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
-
requirements:
|
|
51
|
-
- - "~>"
|
|
52
|
-
- !ruby/object:Gem::Version
|
|
53
|
-
version: '0.2'
|
|
54
|
-
- !ruby/object:Gem::Dependency
|
|
55
|
-
name: omq-rfc-radiodish
|
|
56
|
-
requirement: !ruby/object:Gem::Requirement
|
|
57
|
-
requirements:
|
|
58
|
-
- - "~>"
|
|
59
|
-
- !ruby/object:Gem::Version
|
|
60
|
-
version: '0.2'
|
|
61
|
-
type: :runtime
|
|
62
|
-
prerelease: false
|
|
63
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
-
requirements:
|
|
65
|
-
- - "~>"
|
|
66
|
-
- !ruby/object:Gem::Version
|
|
67
|
-
version: '0.2'
|
|
68
|
-
- !ruby/object:Gem::Dependency
|
|
69
|
-
name: omq-rfc-scattergather
|
|
70
|
-
requirement: !ruby/object:Gem::Requirement
|
|
71
|
-
requirements:
|
|
72
|
-
- - "~>"
|
|
18
|
+
version: '0.26'
|
|
19
|
+
- - ">="
|
|
73
20
|
- !ruby/object:Gem::Version
|
|
74
|
-
version:
|
|
21
|
+
version: 0.26.1
|
|
75
22
|
type: :runtime
|
|
76
23
|
prerelease: false
|
|
77
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
78
25
|
requirements:
|
|
79
26
|
- - "~>"
|
|
80
27
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: '0.
|
|
82
|
-
-
|
|
83
|
-
name: omq-rfc-channel
|
|
84
|
-
requirement: !ruby/object:Gem::Requirement
|
|
85
|
-
requirements:
|
|
86
|
-
- - "~>"
|
|
87
|
-
- !ruby/object:Gem::Version
|
|
88
|
-
version: '0.2'
|
|
89
|
-
type: :runtime
|
|
90
|
-
prerelease: false
|
|
91
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
92
|
-
requirements:
|
|
93
|
-
- - "~>"
|
|
28
|
+
version: '0.26'
|
|
29
|
+
- - ">="
|
|
94
30
|
- !ruby/object:Gem::Version
|
|
95
|
-
version:
|
|
31
|
+
version: 0.26.1
|
|
96
32
|
- !ruby/object:Gem::Dependency
|
|
97
|
-
name:
|
|
33
|
+
name: ffi
|
|
98
34
|
requirement: !ruby/object:Gem::Requirement
|
|
99
35
|
requirements:
|
|
100
|
-
- - "
|
|
36
|
+
- - ">="
|
|
101
37
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: '0
|
|
38
|
+
version: '0'
|
|
103
39
|
type: :runtime
|
|
104
40
|
prerelease: false
|
|
105
41
|
version_requirements: !ruby/object:Gem::Requirement
|
|
106
42
|
requirements:
|
|
107
|
-
- - "
|
|
43
|
+
- - ">="
|
|
108
44
|
- !ruby/object:Gem::Version
|
|
109
|
-
version: '0
|
|
45
|
+
version: '0'
|
|
110
46
|
- !ruby/object:Gem::Dependency
|
|
111
|
-
name: omq-
|
|
47
|
+
name: omq-zstd
|
|
112
48
|
requirement: !ruby/object:Gem::Requirement
|
|
113
49
|
requirements:
|
|
114
50
|
- - "~>"
|
|
115
51
|
- !ruby/object:Gem::Version
|
|
116
|
-
version: '0.
|
|
52
|
+
version: '0.4'
|
|
117
53
|
type: :runtime
|
|
118
54
|
prerelease: false
|
|
119
55
|
version_requirements: !ruby/object:Gem::Requirement
|
|
120
56
|
requirements:
|
|
121
57
|
- - "~>"
|
|
122
58
|
- !ruby/object:Gem::Version
|
|
123
|
-
version: '0.
|
|
59
|
+
version: '0.4'
|
|
124
60
|
- !ruby/object:Gem::Dependency
|
|
125
61
|
name: msgpack
|
|
126
62
|
requirement: !ruby/object:Gem::Requirement
|