ilios 0.4.3 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ceba4d7103c0e542adda7973a184cb9d029b46ba623847bbde1c1b11edbb413e
4
- data.tar.gz: bb78ed04ba7d91d76e312f3427fc9d9785bec6f29c4e361d10f53ad1f60d6ab2
3
+ metadata.gz: d98a43ed2e7d55fc61fa938bf98da7ae866518af91ac38c169bc96b10fedf9db
4
+ data.tar.gz: b09d0ed06e5ff7466d99265c20d4cf43a1b2c9e88701a112e7afd48985ea2854
5
5
  SHA512:
6
- metadata.gz: e28cd2f61d785722dab6f55a9ccabbea253814f9204cce2a3d7b167fef41fe1f6a23fe80b4cc8b9b404136052a82eef38aa72e8bae358fe4fd0786538b147f99
7
- data.tar.gz: 49adffa5274303d4246606b55add435d1dc14cbf63917ac5f2291dfe63f6fac5457847d969317eb0e39cf3cff3d51b6b5480bd9f75ee5bc643afe415c7b38042
6
+ metadata.gz: 276136abb5f4ec998acc5301b2dd069816206c46a1bcc44005587a7454b3661014a31011a814f2f9863dae7eb83fd9c62a31b27fa0769edc5da0632cc0b06d15
7
+ data.tar.gz: 938c8bdf76528f5c953c81df64e76fba4230af03a8af14693fa9cb7cb53638d09b37643510eb68263b1014b7d0fa57bdd54031898666f8ce6599485c40ac8e2c
data/ext/ilios/cluster.c CHANGED
@@ -151,6 +151,23 @@ static VALUE cluster_connect_timeout(VALUE self, VALUE timeout_ms)
151
151
  return self;
152
152
  }
153
153
 
154
+ /**
155
+ * Sets the protocol version. The driver will automatically downgrade to the lowest supported protocol version.
156
+ * Default is +PROTOCOL_VERSION_V4+.
157
+ *
158
+ * @param timeout_ms [Integer] A connect timeout in milliseconds.
159
+ * @return [Cassandra::Cluster] self.
160
+ */
161
+ static VALUE cluster_protocol_version(VALUE self, VALUE version)
162
+ {
163
+ CassandraCluster *cassandra_cluster;
164
+
165
+ GET_CLUSTER(self, cassandra_cluster);
166
+ cass_cluster_set_protocol_version(cassandra_cluster->cluster, NUM2INT(version));
167
+
168
+ return self;
169
+ }
170
+
154
171
  /**
155
172
  * Sets the timeout for waiting for a response from a node.
156
173
  * Default is +12000+ 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/extconf.rb CHANGED
@@ -9,18 +9,22 @@ require 'native-package-installer'
9
9
  have_func('malloc_usable_size')
10
10
  have_func('malloc_size')
11
11
 
12
+ MAX_CORES = 8
13
+
12
14
  def num_cpu_cores
13
15
  cores =
14
16
  begin
15
17
  if RUBY_PLATFORM.include?('darwin')
16
- Integer(`sysctl -n hw.ncpu`, 10) - 1
18
+ Integer(`sysctl -n hw.ncpu`, 10)
17
19
  else
18
- Integer(`nproc`, 10) - 1
20
+ Integer(`nproc`, 10)
19
21
  end
20
22
  rescue StandardError
21
23
  2
22
24
  end
23
- cores.positive? ? cores : 1
25
+
26
+ return 1 if cores <= 0
27
+ cores >= 7 ? MAX_CORES : cores
24
28
  end
25
29
 
26
30
  module LibuvInstaller
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.3'
4
+ VERSION = '0.4.5'
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.3
4
+ version: 0.4.5
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-06 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.3
80
+ documentation_uri: https://www.rubydoc.info/gems/ilios/0.4.5
81
81
  rubygems_mfa_required: 'true'
82
82
  post_install_message:
83
83
  rdoc_options: []