rage-iodine 4.1.0 → 4.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4262f702902096226a678e94c8b73acf61798fb5441c8cfbb04a831cbea7a738
4
- data.tar.gz: fdede223e570118defae54723fe52744cc01548e1c0c71d303dfc4760448d76a
3
+ metadata.gz: 83aa2eec7b36fb5df632957cfd65a8eb751ac4c348b9b2a7eea9ee781cb87b21
4
+ data.tar.gz: '087580ede32c7f097412b83df5b85445c6bae672cf51a2146d0feffa301dc4dd'
5
5
  SHA512:
6
- metadata.gz: 2cf0070ab89370aa02970d80d920ac5b498172e5dfc2ef78b460a1d2d131886ef033a16f96107b3510f4b1652622e133942dcd16d438adead001962bcba54111
7
- data.tar.gz: 85a2937799e604dbd0079668b5432bd785b3550d7e3e5dd94bae41f0b0c7b58ed68c036aad6cbcb79dadaddfb6534a31c0f0b34e34bfb5773c8dbfab84a0656d
6
+ metadata.gz: 2a465a8519ae42055bb93f6617a22834455a1025a2097ed582c1a4f92a53dde28b8efd5bf4a1661961e9606971f1594843e60d632dbf4d408ead29cb80022ef1
7
+ data.tar.gz: ce973cebe1e462548c78d428fad4d9b533413d252374ffd978db920977a4a85e11d6a8683827d5011396512beee7b34bf24eb55225dc2e2ce98c079031c9983a
data/CHANGELOG.md CHANGED
@@ -6,6 +6,14 @@ Please notice that this change log contains changes for upcoming releases as wel
6
6
 
7
7
  ## Changes:
8
8
 
9
+ #### Change log v.4.2.1 (2025-07-26)
10
+
11
+ **Update**: Add `iodine_sub_find`.
12
+
13
+ #### Change log v.4.2.0 (2025-07-23)
14
+
15
+ **Update**: Add `Iodine.subscribed?`.
16
+
9
17
  #### Change log v.4.1.0 (2025-02-07)
10
18
 
11
19
  **Update**: Correctly handle `0` timeouts.
@@ -60,6 +60,12 @@ static inline void iodine_sub_add(fio_subhash_s *store, subscription_s *sub) {
60
60
  fio_str_info_s ch = fio_subscription_channel(sub);
61
61
  fio_subhash_insert(store, fiobj_hash_string(ch.data, ch.len), ch, sub, NULL);
62
62
  }
63
+ static inline VALUE iodine_sub_find(fio_subhash_s *store, fio_str_info_s channel) {
64
+ if (fio_subhash_find(store, fiobj_hash_string(channel.data, channel.len), channel)) {
65
+ return Qtrue;
66
+ }
67
+ return Qfalse;
68
+ }
63
69
  static inline void iodine_sub_clear_all(fio_subhash_s *store) {
64
70
  fio_subhash_free(store);
65
71
  }
@@ -692,6 +698,30 @@ static VALUE iodine_pubsub_unsubscribe(VALUE self, VALUE name) {
692
698
  return ret;
693
699
  }
694
700
 
701
+ static VALUE iodine_pubsub_is_subscribed(VALUE self, VALUE name) {
702
+ // clang-format on
703
+ iodine_connection_data_s *c = NULL;
704
+ fio_lock_i *s_lock = &sub_lock;
705
+ fio_subhash_s *subs = &sub_global;
706
+ VALUE ret;
707
+ if (TYPE(self) != T_MODULE) {
708
+ c = iodine_connection_validate_data(self);
709
+ if (!c || c->info.uuid == -1) {
710
+ return Qfalse; /* the connection is closed */
711
+ }
712
+ s_lock = &c->lock;
713
+ subs = &c->subscriptions;
714
+ }
715
+ if (TYPE(name) == T_SYMBOL)
716
+ name = rb_sym2str(name);
717
+ Check_Type(name, T_STRING);
718
+ fio_lock(s_lock);
719
+ ret = iodine_sub_find(subs, IODINE_RSTRINFO(name));
720
+ fio_unlock(s_lock);
721
+
722
+ return ret;
723
+ }
724
+
695
725
  // clang-format off
696
726
  /**
697
727
  Publishes a message to a channel.
@@ -935,6 +965,8 @@ void iodine_connection_init(void) {
935
965
  // define global methods
936
966
  rb_define_module_function(IodineModule, "subscribe", iodine_pubsub_subscribe,
937
967
  -1);
968
+ rb_define_module_function(IodineModule, "subscribed?",
969
+ iodine_pubsub_is_subscribed, 1);
938
970
  rb_define_module_function(IodineModule, "unsubscribe",
939
971
  iodine_pubsub_unsubscribe, 1);
940
972
  rb_define_module_function(IodineModule, "publish", iodine_pubsub_publish, -1);
@@ -1,3 +1,3 @@
1
1
  module Iodine
2
- VERSION = '4.1.0'.freeze
2
+ VERSION = '4.2.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rage-iodine
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boaz Segev
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-02-07 00:00:00.000000000 Z
10
+ date: 2025-07-26 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rake
@@ -252,7 +251,6 @@ licenses:
252
251
  - MIT
253
252
  metadata:
254
253
  allowed_push_host: https://rubygems.org
255
- post_install_message:
256
254
  rdoc_options: []
257
255
  require_paths:
258
256
  - lib
@@ -274,8 +272,7 @@ requirements:
274
272
  - Ruby >= 2.5.0 recommended.
275
273
  - TLS requires OpenSSL >= 1.1.0.
276
274
  - Or Windows with Ruby >= 3.0.0 build with MingW and MingW as compiler.
277
- rubygems_version: 3.4.10
278
- signing_key:
275
+ rubygems_version: 3.6.2
279
276
  specification_version: 4
280
277
  summary: iodine - a fast HTTP / Websocket Server with Pub/Sub support, optimized for
281
278
  Ruby MRI on Linux / BSD / Windows