asterism-zenoh 0.4.0 → 0.4.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0a06884bbb4ef08eebe9eab69518c1d4c300b345ad7853742cda7ae48175e8d
4
- data.tar.gz: acb609412809b6324c07d2a874819dfffa6499aec3b85d75e9c764bee551e2c4
3
+ metadata.gz: 01674cc1a44ea32694f268a975968ce758c0b5b96bde481f58250d2d2d184dcb
4
+ data.tar.gz: b55af132aafd965e56260d1edbbcdee412391a515aa20d7c6239c477ff93ca35
5
5
  SHA512:
6
- metadata.gz: 861adc9617255ca81225f4782e36c6fc664a37e56c34f778efebd6890359380ca047d9b9f29bc59aa12ddba39bee10f188cf3317244490bdc0299590a93e0e72
7
- data.tar.gz: 75075726af74d8d6bfa6b785ac53b462e805f3445e9a434c94f5d38d07b1839d46493751c584e4c957f771b66ca36e76e11e2ee80bdec718340480c66b36279b
6
+ metadata.gz: d6f9f56ae1068e39a0f0c725c1873478fcde0e7a7767dfc19aa3990de24618a1abde21662ab8018d1e305addea1c32c58a36608f9e5084d616f6845acd7aac65
7
+ data.tar.gz: 4dafb166fe37e312a2038f2493ffcc5af0fb6f5d190daa7d9ce4658492f025f8aa92f4fbd021715c2512dac2a6390b185fcc72671a57cfac0c79f850eb6a7429
data/CHANGELOG.md CHANGED
@@ -2,8 +2,22 @@
2
2
 
3
3
  All notable changes to asterism-zenoh. The mruby / PicoRuby binding
4
4
  (picoruby-asterism-zenoh) carries the same version number from 0.4.0 on.
5
- Nothing has been published to rubygems.org yet; the versions below are
6
- the ones in this repository.
5
+ 0.4.0 is the first version on rubygems.org; the earlier ones are only in
6
+ this repository.
7
+
8
+ ## Unreleased
9
+
10
+ ## 0.4.2
11
+
12
+ A patch of the CRuby binding only; picoruby-asterism-zenoh stays 0.4.1.
13
+
14
+ - Needs CRuby 3.4 or newer (`required_ruby_version >= 3.4`; 3.2 is past its end of life). CI runs Ruby 3.4 and 4.0.
15
+
16
+ ## 0.4.1
17
+
18
+ - A client session is no longer closed when its router goes away: zenoh-c
19
+ reconnects and declares again by itself. `Session#reconnecting?` and
20
+ `AUTO_RECONNECT` (true). `rake test_reconnect` (docker).
7
21
 
8
22
  ## 0.4.0
9
23
 
data/README.md CHANGED
@@ -183,10 +183,15 @@ thread and Enumerators on top of this API are in the CRuby layer of the
183
183
  - **Remote only**: a session's own puts do not reach its own subscribers,
184
184
  and its gets do not reach its own queryables (zenoh-pico's behaviour;
185
185
  Asterism calls its own objects in place).
186
- - **Losing the connection**: a client session is closed when it has no
187
- router left, a peer session that only connects when it has no peer left;
188
- a listening (or scouting) session stays open. From then on `poll` is false, `closed?`
189
- true, and `put` raises `Asterism::Zenoh::Error`. No reconnection.
186
+ - **Losing the connection**: a client session is not closed when its
187
+ router goes away: zenoh-c opens the connection again by itself and
188
+ declares again what the session had declared (subscribers, queryables,
189
+ liveliness tokens and watches); meanwhile `reconnecting?` is true, a put
190
+ reaches nobody and a get ends at its time limit (`rake test_reconnect`:
191
+ back about 1 s after a restarted zenohd). A peer session that only
192
+ connects is closed when it has no peer left; a listening (or scouting)
193
+ session stays open. Once closed, `poll` is false, `closed?` true, and
194
+ `put` raises `Asterism::Zenoh::ClosedError`.
190
195
  - **Full queues drop the oldest** entry and count it in `dropped` (a dropped
191
196
  query is finished, so its requester gets no answer from it).
192
197
 
@@ -222,7 +227,7 @@ own tokens.
222
227
  gem install asterism-zenoh # or `gem install asterism`, which depends on it
223
228
  ```
224
229
 
225
- Needs CRuby 3.2+ and a C compiler; nothing else (no Rust, no git, curl or
230
+ Needs CRuby 3.4+ and a C compiler; nothing else (no Rust, no git, curl or
226
231
  unzip). `gem install` compiles the C extension against the official
227
232
  prebuilt zenoh-c release pinned in `ZENOH_C_PIN`:
228
233
 
@@ -254,7 +259,7 @@ all of it.
254
259
 
255
260
  ## Building and testing
256
261
 
257
- In the repository (needs CRuby 3.2+ and a C compiler):
262
+ In the repository (needs CRuby 3.4+ and a C compiler):
258
263
 
259
264
  ```
260
265
  rake # zenoh_c:fetch, compile, test
@@ -30,11 +30,16 @@
30
30
  * it, the ones without it by the session's op_lock, and closing marks the
31
31
  * session closed for Ruby (with the GVL held) before zenoh-c drops it.
32
32
  *
33
- * Losing the connection (same rules as the mruby gem): a client session is
34
- * closed when it has no router left, a peer session that only connects when
35
- * it has no peer left; a listening peer session stays open. The check runs
36
- * in poll, closed?, put and get. From then on poll returns false, closed?
37
- * is true and put raises Asterism::Zenoh::Error. There is no reconnection.
33
+ * Losing the connection (same rules as the mruby gem):
34
+ * - A client session is not closed when its router goes away: zenoh-c opens
35
+ * the connection again by itself and declares again what the session had
36
+ * declared (subscribers, queryables, liveliness tokens and watches), so
37
+ * the Ruby objects stay valid. Meanwhile reconnecting? is true (no
38
+ * router), put reaches nobody and a get ends at its time limit.
39
+ * - A peer session that only connects is closed when it has no peer left; a
40
+ * listening peer session stays open.
41
+ * The check runs in poll, closed?, put and get. Once closed, poll returns
42
+ * false, closed? is true and put raises Asterism::Zenoh::ClosedError.
38
43
  *
39
44
  * Lifetime: closing is optional. A session keeps lists of its live
40
45
  * subscribers, queryables and tokens and undeclares them before it closes,
@@ -2197,6 +2202,12 @@ static bool zrb_session_check_link(zrb_session *z) {
2197
2202
  if (z->peer && z->listening) {
2198
2203
  return false;
2199
2204
  }
2205
+ if (!z->peer) {
2206
+ /* A client: zenoh-c opens a lost router connection again by itself
2207
+ * (and declares again what the session had declared), so no router
2208
+ * now means "reconnecting", not closed. */
2209
+ return false;
2210
+ }
2200
2211
  if (zrb_session_links(z) == 0) {
2201
2212
  zrb_session_shutdown(z, true);
2202
2213
  return true;
@@ -2204,6 +2215,15 @@ static bool zrb_session_check_link(zrb_session *z) {
2204
2215
  return false;
2205
2216
  }
2206
2217
 
2218
+ /* True while a client session has no router (zenoh-c is opening the
2219
+ * connection again). */
2220
+ static bool zrb_session_reconnecting(zrb_session *z) {
2221
+ if (zrb_session_check_link(z) || z->peer) {
2222
+ return false;
2223
+ }
2224
+ return zrb_session_links(z) == 0;
2225
+ }
2226
+
2207
2227
  static zrb_session *zrb_session_get_open(VALUE self) {
2208
2228
  zrb_session *z = zrb_session_get(self);
2209
2229
  if (z->open && z->pid != getpid()) {
@@ -2823,6 +2843,12 @@ static VALUE zrb_session_closed_p(VALUE self) {
2823
2843
  return zrb_session_check_link(zrb_session_get(self)) ? Qtrue : Qfalse;
2824
2844
  }
2825
2845
 
2846
+ /* session.reconnecting? -> true while a client session has no router and
2847
+ * zenoh-c opens the connection again (see the top of this file). */
2848
+ static VALUE zrb_session_reconnecting_p(VALUE self) {
2849
+ return zrb_session_reconnecting(zrb_session_get(self)) ? Qtrue : Qfalse;
2850
+ }
2851
+
2826
2852
  static VALUE zrb_session_close(VALUE self) {
2827
2853
  zrb_session_shutdown(zrb_session_get(self), true);
2828
2854
  return Qnil;
@@ -4137,6 +4163,8 @@ void Init_asterism_zenoh(void) {
4137
4163
  rb_define_const(mZenoh, "CONNECT_TIMEOUT_MS", INT2FIX(ZRB_CONNECT_TIMEOUT_MS));
4138
4164
  rb_define_const(mZenoh, "SEND_TIMEOUT_MS", INT2FIX(ZRB_SEND_TIMEOUT_MS));
4139
4165
  rb_define_const(mZenoh, "PEER", Qtrue);
4166
+ /* A client session opens a lost router connection again (zenoh-c). */
4167
+ rb_define_const(mZenoh, "AUTO_RECONNECT", Qtrue);
4140
4168
  /* Queue depths: the default of subscribe, queryable and the listeners;
4141
4169
  * of get, liveliness_get and querier.get; of liveliness_watch; and the
4142
4170
  * largest accepted. */
@@ -4200,6 +4228,7 @@ void Init_asterism_zenoh(void) {
4200
4228
  rb_define_method(cSession, "connection_count", zrb_session_peers, 0);
4201
4229
  rb_define_method(cSession, "zid", zrb_session_zid, 0);
4202
4230
  rb_define_method(cSession, "closed?", zrb_session_closed_p, 0);
4231
+ rb_define_method(cSession, "reconnecting?", zrb_session_reconnecting_p, 0);
4203
4232
  rb_define_method(cSession, "close", zrb_session_close, 0);
4204
4233
 
4205
4234
  /* Subscriber and LivelinessWatch share one C structure. */
@@ -1,6 +1,6 @@
1
1
  module Asterism
2
2
  module Zenoh
3
3
  # The gem's version.
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.2"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asterism-zenoh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katsuhiko Kageyama
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2026-10-09 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: Sessions, put / subscribe, get / queryable, liveliness and attachments,
14
13
  received by polling. The same Ruby API as Asterism's mruby / PicoRuby binding, plus
@@ -16,7 +15,6 @@ description: Sessions, put / subscribe, get / queryable, liveliness and attachme
16
15
  publisher / subscriber, events, key expressions and timestamps. The C extension
17
16
  is compiled at install time against the official prebuilt zenoh-c release for the
18
17
  machine, downloaded and checked against a pinned sha256.
19
- email:
20
18
  executables: []
21
19
  extensions:
22
20
  - ext/asterism_zenoh/extconf.rb
@@ -47,7 +45,6 @@ metadata:
47
45
  source_code_uri: https://github.com/ruby-asterism/asterism-zenoh
48
46
  bug_tracker_uri: https://github.com/ruby-asterism/asterism-zenoh/issues
49
47
  rubygems_mfa_required: 'true'
50
- post_install_message:
51
48
  rdoc_options: []
52
49
  require_paths:
53
50
  - lib
@@ -55,15 +52,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
55
52
  requirements:
56
53
  - - ">="
57
54
  - !ruby/object:Gem::Version
58
- version: '3.2'
55
+ version: '3.4'
59
56
  required_rubygems_version: !ruby/object:Gem::Requirement
60
57
  requirements:
61
58
  - - ">="
62
59
  - !ruby/object:Gem::Version
63
60
  version: '0'
64
61
  requirements: []
65
- rubygems_version: 3.4.19
66
- signing_key:
62
+ rubygems_version: 3.6.9
67
63
  specification_version: 4
68
64
  summary: 'Asterism::Zenoh: an unofficial Zenoh binding for Ruby (over zenoh-c)'
69
65
  test_files: []