ilios 0.4.4 → 0.4.6

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: e28970c92e0e274f14457318e1ab9ddd17dcdb197cc89084d2d58fe9b51afb14
4
- data.tar.gz: 9dab2538fd742cc4f85ae9a864348a97ba6d9655ababbd633c1477781be5274d
3
+ metadata.gz: bfc0036bce9b2d84aa66c517c58772bc084a8377997953b149c8192e660d836a
4
+ data.tar.gz: be99b813f53b6abe7d1faa86fe7006e34c202d65928c64f41893c68a77cd9275
5
5
  SHA512:
6
- metadata.gz: fe695966bf3b1dacf3825ceb73d689b7b38f4488fb11d3bdea777942aa0c7e5b653d2a3be2eff4cc5cc897af489583deb6ae383874a0c814e4270452091dc4b1
7
- data.tar.gz: 310d435e083b862b4e890edd4195ff58363494fd7b4c47612d7cc1fbd794f80faab7da6e2fdb333b26df49326641ab87803805f39e7ff14cab0c915d8d539015
6
+ metadata.gz: 55fe1cc2ea9e157e81f6d52fd54aeb2e5259f5ce3e078f54260abe76423280464752e3591da167c26c1dd783413cda5ae202f884a7df3d0625ee719724b03673
7
+ data.tar.gz: c2315325480d67a765d0f9b8588649b9bfdc8a99fe2489c4013090faf1d9f44f3f3458258d842aab2203b49d9385fb84393b01b113f9e4debdd58a34060b29cf
data/ext/ilios/cluster.c CHANGED
@@ -134,6 +134,23 @@ static VALUE cluster_keyspace(VALUE self, VALUE keyspace)
134
134
  return self;
135
135
  }
136
136
 
137
+ /**
138
+ * Sets the protocol version. The driver will automatically downgrade to the lowest supported protocol version.
139
+ * Default is +PROTOCOL_VERSION_V4+.
140
+ *
141
+ * @param timeout_ms [Integer] A connect timeout in milliseconds.
142
+ * @return [Cassandra::Cluster] self.
143
+ */
144
+ static VALUE cluster_protocol_version(VALUE self, VALUE version)
145
+ {
146
+ CassandraCluster *cassandra_cluster;
147
+
148
+ GET_CLUSTER(self, cassandra_cluster);
149
+ cass_cluster_set_protocol_version(cassandra_cluster->cluster, NUM2INT(version));
150
+
151
+ return self;
152
+ }
153
+
137
154
  /**
138
155
  * Sets the timeout for connecting to a node.
139
156
  * Default is +5000+ milliseconds.
@@ -242,9 +259,17 @@ void Init_cluster(void)
242
259
  rb_define_method(cCluster, "hosts", cluster_hosts, 1);
243
260
  rb_define_method(cCluster, "port", cluster_port, 1);
244
261
  rb_define_method(cCluster, "keyspace", cluster_keyspace, 1);
262
+ rb_define_method(cCluster, "protocol_version", cluster_protocol_version, 1);
245
263
  rb_define_method(cCluster, "connect_timeout", cluster_connect_timeout, 1);
246
264
  rb_define_method(cCluster, "request_timeout", cluster_request_timeout, 1);
247
265
  rb_define_method(cCluster, "resolve_timeout", cluster_resolve_timeout, 1);
248
266
  rb_define_method(cCluster, "constant_speculative_execution_policy", cluster_constant_speculative_execution_policy, 2);
249
267
 
268
+ rb_define_const(cCluster, "PROTOCOL_VERSION_V1", INT2NUM(CASS_PROTOCOL_VERSION_V1));
269
+ rb_define_const(cCluster, "PROTOCOL_VERSION_V2", INT2NUM(CASS_PROTOCOL_VERSION_V2));
270
+ rb_define_const(cCluster, "PROTOCOL_VERSION_V3", INT2NUM(CASS_PROTOCOL_VERSION_V3));
271
+ rb_define_const(cCluster, "PROTOCOL_VERSION_V4", INT2NUM(CASS_PROTOCOL_VERSION_V4));
272
+ rb_define_const(cCluster, "PROTOCOL_VERSION_V5", INT2NUM(CASS_PROTOCOL_VERSION_V5));
273
+ rb_define_const(cCluster, "PROTOCOL_VERSION_DSEV1", INT2NUM(CASS_PROTOCOL_VERSION_DSEV1));
274
+ rb_define_const(cCluster, "PROTOCOL_VERSION_DSEV2", INT2NUM(CASS_PROTOCOL_VERSION_DSEV2));
250
275
  }
data/ext/ilios/future.c CHANGED
@@ -33,10 +33,23 @@ static void future_thread_pool_init(future_thread_pool *pool)
33
33
  {
34
34
  pool->queue = rb_funcall(cQueue, id_new, 0);
35
35
  rb_gc_register_mark_object(pool->queue);
36
+ }
37
+
38
+ static void future_thread_pool_prepare_thread(future_thread_pool *pool)
39
+ {
40
+ VALUE status;
36
41
 
37
42
  for (int i = 0; i < THREAD_MAX; i++) {
38
- pool->thread[i] = rb_thread_create(future_result_yielder_thread, (void*)pool);
39
- rb_gc_register_mark_object(pool->thread[i]);
43
+ status = Qfalse;
44
+
45
+ if (pool->thread[i]) {
46
+ status = rb_funcall(pool->thread[i], id_alive, 0);
47
+ }
48
+ if (!pool->thread[i] || !RTEST(status)) {
49
+ pool->thread[i] = rb_thread_create(future_result_yielder_thread, (void*)pool);
50
+ rb_funcall(pool->thread[i], id_report_on_exception, 1, Qtrue);
51
+ rb_gc_register_address(&pool->thread[i]);
52
+ }
40
53
  }
41
54
  }
42
55
 
@@ -58,6 +71,7 @@ static inline future_thread_pool *future_thread_pool_get(CassandraFuture *cassan
58
71
  static inline void future_queue_push(future_thread_pool *pool, VALUE future)
59
72
  {
60
73
  rb_funcall(pool->queue, id_push, 1, future);
74
+ future_thread_pool_prepare_thread(pool);
61
75
  }
62
76
 
63
77
  static inline VALUE future_queue_pop(future_thread_pool *pool)
@@ -137,7 +151,6 @@ static VALUE future_result_yielder_body(VALUE future)
137
151
 
138
152
  nogvl_future_wait(cassandra_future->future);
139
153
  return rb_mutex_synchronize(cassandra_future->proc_mutex, future_result_yielder_synchronize, future);
140
-
141
154
  }
142
155
 
143
156
  static VALUE future_result_yielder_ensure(VALUE future)
data/ext/ilios/ilios.c CHANGED
@@ -17,6 +17,8 @@ VALUE id_to_time;
17
17
  VALUE id_new;
18
18
  VALUE id_push;
19
19
  VALUE id_pop;
20
+ VALUE id_alive;
21
+ VALUE id_report_on_exception;
20
22
  VALUE sym_unsupported_column_type;
21
23
 
22
24
  #if defined(HAVE_MALLOC_USABLE_SIZE)
@@ -77,6 +79,8 @@ void Init_ilios(void)
77
79
  id_new = rb_intern("new");
78
80
  id_push = rb_intern("push");
79
81
  id_pop = rb_intern("pop");
82
+ id_alive = rb_intern("alive?");
83
+ id_report_on_exception = rb_intern("report_on_exception=");
80
84
  sym_unsupported_column_type = ID2SYM(rb_intern("unsupported_column_type"));
81
85
 
82
86
  Init_cluster();
data/ext/ilios/ilios.h CHANGED
@@ -91,6 +91,8 @@ extern VALUE id_to_time;
91
91
  extern VALUE id_new;
92
92
  extern VALUE id_push;
93
93
  extern VALUE id_pop;
94
+ extern VALUE id_alive;
95
+ extern VALUE id_report_on_exception;
94
96
  extern VALUE sym_unsupported_column_type;
95
97
 
96
98
  extern void Init_cluster(void);
data/lib/ilios/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ilios
4
- VERSION = '0.4.4'
4
+ VERSION = '0.4.6'
5
5
  public_constant :VERSION
6
6
 
7
7
  CASSANDRA_CPP_DRIVER_VERSION = '2.17.1'
data/sig/ilios.rbs CHANGED
@@ -7,6 +7,7 @@ module Ilios
7
7
  def hosts: (Array[String]) -> self
8
8
  def port: (Integer) -> self
9
9
  def keyspace: (String) -> self
10
+ def protocol_version: (Integer) -> self
10
11
  def connect_timeout: (Integer) -> self
11
12
  def request_timeout: (Integer) -> self
12
13
  def resolve_timeout: (Integer) -> self
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ilios
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Watson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-05 00:00:00.000000000 Z
11
+ date: 2024-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mini_portile2
@@ -77,7 +77,7 @@ metadata:
77
77
  homepage_uri: https://github.com/Watson1978/ilios
78
78
  source_code_uri: https://github.com/Watson1978/ilios
79
79
  bug_tracker_uri: https://github.com/Watson1978/ilios/issues
80
- documentation_uri: https://www.rubydoc.info/gems/ilios/0.4.4
80
+ documentation_uri: https://www.rubydoc.info/gems/ilios/0.4.6
81
81
  rubygems_mfa_required: 'true'
82
82
  post_install_message:
83
83
  rdoc_options: []