ilios 0.2.2 → 0.3.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 +4 -4
- data/README.md +26 -1
- data/docker-compose.yml +4 -2
- data/ext/ilios/cassandra.c +11 -17
- data/ext/ilios/extconf.rb +121 -31
- data/ext/ilios/future.c +18 -1
- data/ext/ilios/ilios.c +0 -2
- data/ext/ilios/ilios.h +1 -1
- data/ext/ilios/result.c +1 -1
- data/ext/ilios/statement.c +19 -0
- data/ilios.gemspec +3 -2
- data/lib/ilios/version.rb +1 -1
- data/sig/ilios.rbs +37 -1
- metadata +17 -4
- data/Dockerfile +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97cd17ec9e27eba88f4200dc050417934daa8820a8c6621b47ffa0e76d4f38be
|
4
|
+
data.tar.gz: '0508e6e770984ba635caa2a587a69a7a2a0b7eedab2016dfa1292480ddf81ea6'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b882a9744b4cde1c74429c6a4ab3bc8de0338ac0e7b56a9bd657ad0c843a35c77deaa884e2a898c5b5ae5a4dff5c8d8aadfce30a4000dbf4df103e7376bd3b1c
|
7
|
+
data.tar.gz: 66757dbdfc249e68613f1ace36092520b8efad5d82db1f41a15ba8b0b2226502abd6bb288a9e7a73d6e82f7c0491bb2f86de3e977b4556cced7ae50c4feff439
|
data/README.md
CHANGED
@@ -16,12 +16,36 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
16
16
|
$ gem install ilios
|
17
17
|
```
|
18
18
|
|
19
|
+
This gem's installer will install the DataStax C/C++ Driver to the appropriate location automatically.
|
20
|
+
However, if you prefer to install the DataStax C/C++ Driver manually, you can do so by executing:
|
21
|
+
|
22
|
+
```sh
|
23
|
+
$ bundle config set --local build.ilios --with-cpp-driver-dir=/path/to/cassandra-cpp-driver-installed-dir
|
24
|
+
$ bundle add ilios
|
25
|
+
```
|
26
|
+
|
27
|
+
or
|
28
|
+
|
29
|
+
```sh
|
30
|
+
$ gem install ilios -- --with-cpp-driver-dir=/path/to/cassandra-cpp-driver-installed-dir
|
31
|
+
```
|
32
|
+
|
33
|
+
## Requirements
|
34
|
+
|
35
|
+
- cmake (in order to build the DataStax C/C++ Driver and libuv)
|
36
|
+
|
37
|
+
## Supported
|
38
|
+
|
39
|
+
- Ruby 3.0 or later
|
40
|
+
- Cassandra 3.0 or later
|
41
|
+
- Linux and macOS platform
|
42
|
+
|
19
43
|
## Example
|
20
44
|
### Basic usage
|
21
45
|
|
22
46
|
Create the keyspace in advance using the `cqlsh` command.
|
23
47
|
|
24
|
-
```
|
48
|
+
```cql
|
25
49
|
CREATE KEYSPACE IF NOT EXISTS ilios
|
26
50
|
WITH REPLICATION = {
|
27
51
|
'class' : 'SimpleStrategy',
|
@@ -73,6 +97,7 @@ end
|
|
73
97
|
statement = Ilios::Cassandra.session.prepare(<<~CQL)
|
74
98
|
SELECT * FROM ilios.example
|
75
99
|
CQL
|
100
|
+
statement.idempotent = true
|
76
101
|
statement.page_size = 25
|
77
102
|
result = Ilios::Cassandra.session.execute(statement)
|
78
103
|
result.each do |row|
|
data/docker-compose.yml
CHANGED
@@ -8,10 +8,12 @@ services:
|
|
8
8
|
- cassandra-data:/var/lib/cassandra
|
9
9
|
ilios:
|
10
10
|
build:
|
11
|
-
context:
|
12
|
-
dockerfile:
|
11
|
+
context: ./dockerfiles
|
12
|
+
dockerfile: ubuntu.dockerfile
|
13
13
|
depends_on:
|
14
14
|
- cassandra
|
15
|
+
environment:
|
16
|
+
CASSANDRA_HOST: cassandra
|
15
17
|
command: bash -c 'sleep infinity'
|
16
18
|
volumes:
|
17
19
|
- "./:/opt/ilios"
|
data/ext/ilios/cassandra.c
CHANGED
@@ -14,7 +14,6 @@ static VALUE cassandra_connect(VALUE self)
|
|
14
14
|
VALUE config;
|
15
15
|
VALUE hosts;
|
16
16
|
VALUE keyspace;
|
17
|
-
char last_error[4096] = { 0 };
|
18
17
|
|
19
18
|
cassandra_session_obj = CREATE_SESSION(cassandra_session);
|
20
19
|
|
@@ -39,29 +38,24 @@ static VALUE cassandra_connect(VALUE self)
|
|
39
38
|
|
40
39
|
for (int i = 0; i < RARRAY_LEN(hosts); i++) {
|
41
40
|
VALUE host = RARRAY_AREF(hosts, i);
|
42
|
-
|
43
|
-
cass_cluster_set_contact_points(cassandra_session->cluster, ""); // Clear previous contact points
|
44
41
|
cass_cluster_set_contact_points(cassandra_session->cluster, StringValueCStr(host));
|
45
|
-
|
46
|
-
|
47
|
-
|
42
|
+
}
|
43
|
+
cassandra_session->session = cass_session_new();
|
44
|
+
cassandra_session->connect_future = cass_session_connect_keyspace(cassandra_session->session, cassandra_session->cluster, StringValueCStr(keyspace));
|
45
|
+
nogvl_future_wait(cassandra_session->connect_future);
|
48
46
|
|
49
|
-
|
50
|
-
|
51
|
-
}
|
47
|
+
if (cass_future_error_code(cassandra_session->connect_future) != CASS_OK) {
|
48
|
+
char error[4096] = { 0 };
|
52
49
|
|
53
|
-
strncpy(
|
50
|
+
strncpy(error, cass_error_desc(cass_future_error_code(cassandra_session->connect_future)), sizeof(error) - 1);
|
54
51
|
cass_future_free(cassandra_session->connect_future);
|
55
52
|
cass_session_free(cassandra_session->session);
|
56
|
-
cassandra_session->
|
57
|
-
|
53
|
+
cass_cluster_free(cassandra_session->cluster);
|
54
|
+
rb_raise(eConnectError, "Unable to connect: %s", error);
|
55
|
+
return Qnil;
|
58
56
|
}
|
59
57
|
|
60
|
-
|
61
|
-
cassandra_session->cluster = NULL;
|
62
|
-
|
63
|
-
rb_raise(eConnectError, "Unable to connect: %s", last_error);
|
64
|
-
return Qnil;
|
58
|
+
return cassandra_session_obj;
|
65
59
|
}
|
66
60
|
|
67
61
|
void Init_cassandra(void)
|
data/ext/ilios/extconf.rb
CHANGED
@@ -4,13 +4,11 @@ require File.expand_path('../../lib/ilios/version', __dir__)
|
|
4
4
|
require 'fileutils'
|
5
5
|
require 'mini_portile2'
|
6
6
|
require 'mkmf'
|
7
|
+
require 'native-package-installer'
|
7
8
|
|
8
9
|
have_func('malloc_usable_size')
|
9
10
|
have_func('malloc_size')
|
10
11
|
|
11
|
-
CASSANDRA_CPP_DRIVER_INSTALL_PATH = File.expand_path('cpp-driver')
|
12
|
-
LIBUV_INSTALL_PATH = File.expand_path('libuv')
|
13
|
-
|
14
12
|
unless find_executable('cmake')
|
15
13
|
puts '--------------------------------------------------'
|
16
14
|
puts 'Error: cmake is required to build this gem'
|
@@ -18,33 +16,93 @@ unless find_executable('cmake')
|
|
18
16
|
raise
|
19
17
|
end
|
20
18
|
|
21
|
-
|
19
|
+
if RUBY_PLATFORM.include?('darwin') && !find_executable('install_name_tool')
|
20
|
+
puts('------------------------------------------------------')
|
21
|
+
puts('Error: install_name_tool is required to build this gem')
|
22
|
+
puts('------------------------------------------------------')
|
23
|
+
raise
|
24
|
+
end
|
25
|
+
|
26
|
+
def num_cpu_cores
|
27
|
+
cores =
|
28
|
+
begin
|
29
|
+
if RUBY_PLATFORM.include?('darwin')
|
30
|
+
Integer(`sysctl -n hw.ncpu`, 10) - 1
|
31
|
+
else
|
32
|
+
Integer(`nproc`, 10) - 1
|
33
|
+
end
|
34
|
+
rescue StandardError
|
35
|
+
2
|
36
|
+
end
|
37
|
+
cores.positive? ? cores : 1
|
38
|
+
end
|
39
|
+
|
40
|
+
module LibuvInstaller
|
41
|
+
LIBUV_INSTALL_PATH = File.expand_path('libuv')
|
42
|
+
private_constant :LIBUV_INSTALL_PATH
|
43
|
+
|
44
|
+
@@special_install_path = nil
|
45
|
+
|
22
46
|
class LibuvRecipe < MiniPortileCMake
|
23
47
|
def configure_prefix
|
24
48
|
"-DCMAKE_INSTALL_PREFIX=#{LIBUV_INSTALL_PATH}"
|
25
49
|
end
|
26
50
|
end
|
27
51
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
52
|
+
def self.install
|
53
|
+
return if install_from_package
|
54
|
+
|
55
|
+
install_from_source
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.install_from_package
|
59
|
+
NativePackageInstaller.install(
|
60
|
+
arch_linux: 'libuv',
|
61
|
+
alt_linux: 'libuv',
|
62
|
+
debian: 'libuv1-dev',
|
63
|
+
freebsd: 'libuv',
|
64
|
+
gentoo_linux: 'libuv',
|
65
|
+
homebrew: 'libuv',
|
66
|
+
macports: 'libuv',
|
67
|
+
redhat: 'libuv-devel'
|
68
|
+
)
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.install_from_source
|
72
|
+
unless File.exist?(LIBUV_INSTALL_PATH)
|
73
|
+
libuv_recipe = LibuvRecipe.new('libuv', Ilios::LIBUV_VERSION, make_command: "make -j #{num_cpu_cores}")
|
74
|
+
libuv_recipe.files << {
|
75
|
+
url: "https://github.com/libuv/libuv/archive/v#{Ilios::LIBUV_VERSION}.tar.gz"
|
76
|
+
}
|
77
|
+
libuv_recipe.cook
|
78
|
+
if RUBY_PLATFORM.include?('darwin')
|
79
|
+
xsystem(
|
80
|
+
"install_name_tool -id #{LIBUV_INSTALL_PATH}/lib/libuv.1.dylib #{LIBUV_INSTALL_PATH}/lib/libuv.1.dylib"
|
81
|
+
)
|
82
|
+
end
|
39
83
|
end
|
40
|
-
|
84
|
+
@@special_install_path = LIBUV_INSTALL_PATH
|
85
|
+
|
86
|
+
FileUtils.rm_rf('ports')
|
87
|
+
FileUtils.rm_rf('tmp')
|
88
|
+
|
89
|
+
$CPPFLAGS += " -I#{LIBUV_INSTALL_PATH}/include"
|
90
|
+
$LDFLAGS += " -L#{LIBUV_INSTALL_PATH}/lib -Wl,-rpath,#{LIBUV_INSTALL_PATH}/lib -luv"
|
91
|
+
end
|
92
|
+
|
93
|
+
def self.special_install_path
|
94
|
+
@@special_install_path
|
41
95
|
end
|
42
96
|
end
|
43
97
|
|
44
|
-
|
98
|
+
module CassandraDriverInstaller
|
99
|
+
CASSANDRA_CPP_DRIVER_INSTALL_PATH = File.expand_path('cpp-driver')
|
100
|
+
private_constant :CASSANDRA_CPP_DRIVER_INSTALL_PATH
|
101
|
+
|
45
102
|
class CassandraRecipe < MiniPortileCMake
|
46
103
|
def initialize(name, version, **kwargs)
|
47
|
-
ENV['LIBUV_ROOT_DIR'] =
|
104
|
+
ENV['LIBUV_ROOT_DIR'] = LibuvInstaller.special_install_path
|
105
|
+
|
48
106
|
super(name, version, **kwargs)
|
49
107
|
end
|
50
108
|
|
@@ -53,21 +111,53 @@ unless File.exist?(CASSANDRA_CPP_DRIVER_INSTALL_PATH)
|
|
53
111
|
end
|
54
112
|
end
|
55
113
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
cassandra_recipe.cook
|
61
|
-
if RUBY_PLATFORM.include?('darwin')
|
62
|
-
xsystem("install_name_tool -id #{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/lib/libcassandra.2.dylib #{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/lib/libcassandra.2.dylib")
|
114
|
+
def self.install
|
115
|
+
return if install_from_package
|
116
|
+
|
117
|
+
install_from_source
|
63
118
|
end
|
64
|
-
end
|
65
119
|
|
66
|
-
|
67
|
-
|
120
|
+
def self.install_from_package
|
121
|
+
# Install Cassandra C/C++ driver via MiniPortile2.
|
122
|
+
# It doesn't provide pre-built package in some official repository.
|
123
|
+
return unless NativePackageInstaller.install(homebrew: 'cassandra-cpp-driver')
|
124
|
+
|
125
|
+
path = `brew --prefix cassandra-cpp-driver`.strip
|
126
|
+
$CPPFLAGS += " -I#{path}/include"
|
127
|
+
$LDFLAGS += " -L#{path}/lib -Wl,-rpath,#{path}/lib -lcassandra"
|
128
|
+
|
129
|
+
true
|
130
|
+
end
|
131
|
+
|
132
|
+
def self.install_from_source
|
133
|
+
unless File.exist?(CASSANDRA_CPP_DRIVER_INSTALL_PATH)
|
134
|
+
cassandra_recipe = CassandraRecipe.new('cpp-driver', Ilios::CASSANDRA_CPP_DRIVER_VERSION, make_command: "make -j #{num_cpu_cores}")
|
135
|
+
cassandra_recipe.files << {
|
136
|
+
url: "https://github.com/datastax/cpp-driver/archive/#{Ilios::CASSANDRA_CPP_DRIVER_VERSION}.tar.gz"
|
137
|
+
}
|
138
|
+
cassandra_recipe.cook
|
139
|
+
if RUBY_PLATFORM.include?('darwin')
|
140
|
+
xsystem(
|
141
|
+
"install_name_tool -id #{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/lib/libcassandra.2.dylib #{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/lib/libcassandra.2.dylib"
|
142
|
+
)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
@@installed_path_from_source = CASSANDRA_CPP_DRIVER_INSTALL_PATH
|
146
|
+
|
147
|
+
FileUtils.rm_rf('ports')
|
148
|
+
FileUtils.rm_rf('tmp')
|
68
149
|
|
69
|
-
$CPPFLAGS += " -I#{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/include
|
70
|
-
$LDFLAGS += " -L#{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/lib -Wl,-rpath,#{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/lib -lcassandra"
|
71
|
-
|
150
|
+
$CPPFLAGS += " -I#{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/include"
|
151
|
+
$LDFLAGS += " -L#{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/lib -Wl,-rpath,#{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/lib -lcassandra"
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
if (dir = with_config('--with-cassandra-driver-dir'))
|
156
|
+
$CPPFLAGS += " -I#{dir}/include"
|
157
|
+
$LDFLAGS += " -L#{dir}/lib -Wl,-rpath,#{dir}/lib -lcassandra"
|
158
|
+
else
|
159
|
+
LibuvInstaller.install
|
160
|
+
CassandraDriverInstaller.install
|
161
|
+
end
|
72
162
|
|
73
163
|
create_makefile('ilios')
|
data/ext/ilios/future.c
CHANGED
@@ -34,7 +34,6 @@ static void future_thread_pool_init(future_thread_pool *pool)
|
|
34
34
|
pool->queue = rb_funcall(cQueue, id_new, 0);
|
35
35
|
for (int i = 0; i < THREAD_MAX; i++) {
|
36
36
|
pool->thread[i] = rb_thread_create(future_result_yielder_thread, (void*)pool);
|
37
|
-
rb_funcall(pool->thread[i], id_abort_on_exception_set, 1, Qtrue);
|
38
37
|
}
|
39
38
|
}
|
40
39
|
|
@@ -212,6 +211,15 @@ static VALUE future_on_success(VALUE self)
|
|
212
211
|
|
213
212
|
cassandra_future->on_success_block = rb_block_proc();
|
214
213
|
|
214
|
+
if (cass_future_ready(cassandra_future->future)) {
|
215
|
+
rb_mutex_unlock(cassandra_future->proc_mutex);
|
216
|
+
uv_sem_post(&cassandra_future->sem);
|
217
|
+
if (cass_future_error_code(cassandra_future->future) == CASS_OK) {
|
218
|
+
future_result_success_yield(cassandra_future);
|
219
|
+
}
|
220
|
+
return self;
|
221
|
+
}
|
222
|
+
|
215
223
|
if (wakeup_thread) {
|
216
224
|
future_queue_push(future_thread_pool_get(cassandra_future), self);
|
217
225
|
}
|
@@ -250,6 +258,15 @@ static VALUE future_on_failure(VALUE self)
|
|
250
258
|
|
251
259
|
cassandra_future->on_failure_block = rb_block_proc();
|
252
260
|
|
261
|
+
if (cass_future_ready(cassandra_future->future)) {
|
262
|
+
rb_mutex_unlock(cassandra_future->proc_mutex);
|
263
|
+
uv_sem_post(&cassandra_future->sem);
|
264
|
+
if (cass_future_error_code(cassandra_future->future) != CASS_OK) {
|
265
|
+
future_result_failure_yield(cassandra_future);
|
266
|
+
}
|
267
|
+
return self;
|
268
|
+
}
|
269
|
+
|
253
270
|
if (wakeup_thread) {
|
254
271
|
future_queue_push(future_thread_pool_get(cassandra_future), self);
|
255
272
|
}
|
data/ext/ilios/ilios.c
CHANGED
@@ -15,7 +15,6 @@ VALUE cQueue;
|
|
15
15
|
VALUE id_cvar_config;
|
16
16
|
VALUE id_shuffle;
|
17
17
|
VALUE id_to_time;
|
18
|
-
VALUE id_abort_on_exception_set;
|
19
18
|
VALUE id_new;
|
20
19
|
VALUE id_push;
|
21
20
|
VALUE id_pop;
|
@@ -81,7 +80,6 @@ void Init_ilios(void)
|
|
81
80
|
id_cvar_config = rb_intern("@@config");
|
82
81
|
id_shuffle = rb_intern("shuffle");
|
83
82
|
id_to_time = rb_intern("to_time");
|
84
|
-
id_abort_on_exception_set = rb_intern("abort_on_exception=");
|
85
83
|
id_new = rb_intern("new");
|
86
84
|
id_push = rb_intern("push");
|
87
85
|
id_pop = rb_intern("pop");
|
data/ext/ilios/ilios.h
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
#include <uv.h>
|
8
8
|
#include "ruby.h"
|
9
9
|
#include "ruby/thread.h"
|
10
|
+
#include "ruby/encoding.h"
|
10
11
|
|
11
12
|
#define GET_SESSION(obj, var) TypedData_Get_Struct(obj, CassandraSession, &cassandra_session_data_type, var)
|
12
13
|
#define GET_STATEMENT(obj, var) TypedData_Get_Struct(obj, CassandraStatement, &cassandra_statement_data_type, var)
|
@@ -79,7 +80,6 @@ extern VALUE cQueue;
|
|
79
80
|
extern VALUE id_cvar_config;
|
80
81
|
extern VALUE id_shuffle;
|
81
82
|
extern VALUE id_to_time;
|
82
|
-
extern VALUE id_abort_on_exception_set;
|
83
83
|
extern VALUE id_new;
|
84
84
|
extern VALUE id_push;
|
85
85
|
extern VALUE id_pop;
|
data/ext/ilios/result.c
CHANGED
@@ -80,7 +80,7 @@ static VALUE result_convert_row(const CassResult *result, const CassRow *row, si
|
|
80
80
|
const CassValueType type = cass_value_type(value);
|
81
81
|
|
82
82
|
cass_result_column_name(result, i, &name, &name_length);
|
83
|
-
key =
|
83
|
+
key = rb_enc_interned_str(name, name_length, rb_utf8_encoding());
|
84
84
|
|
85
85
|
if (cass_value_is_null(value)) {
|
86
86
|
rb_hash_aset(hash, key, Qnil);
|
data/ext/ilios/statement.c
CHANGED
@@ -21,6 +21,7 @@ void statement_default_config(CassandraStatement *cassandra_statement)
|
|
21
21
|
{
|
22
22
|
VALUE config = rb_cvar_get(mCassandra, id_cvar_config);
|
23
23
|
|
24
|
+
cass_statement_set_request_timeout(cassandra_statement->statement, NUM2INT(rb_hash_aref(config, sym_timeout_ms)));
|
24
25
|
cass_statement_set_paging_size(cassandra_statement->statement, NUM2INT(rb_hash_aref(config, sym_page_size)));
|
25
26
|
}
|
26
27
|
|
@@ -186,6 +187,23 @@ static VALUE statement_page_size(VALUE self, VALUE page_size)
|
|
186
187
|
return self;
|
187
188
|
}
|
188
189
|
|
190
|
+
/**
|
191
|
+
* Sets whether the statement is idempotent. Idempotent statements are able to be
|
192
|
+
* automatically retried after timeouts/errors and can be speculatively executed.
|
193
|
+
* The default is +false+.
|
194
|
+
*
|
195
|
+
* @param idempotent [Boolean] Whether the statement is idempotent.
|
196
|
+
* @return [Cassandra::Statement] self.
|
197
|
+
*/
|
198
|
+
static VALUE statement_idempotent(VALUE self, VALUE idempotent)
|
199
|
+
{
|
200
|
+
CassandraStatement *cassandra_statement;
|
201
|
+
|
202
|
+
GET_STATEMENT(self, cassandra_statement);
|
203
|
+
cass_statement_set_is_idempotent(cassandra_statement->statement, RTEST(idempotent) ? cass_true : cass_false);
|
204
|
+
return self;
|
205
|
+
}
|
206
|
+
|
189
207
|
static void statement_mark(void *ptr)
|
190
208
|
{
|
191
209
|
CassandraStatement *cassandra_statement = (CassandraStatement *)ptr;
|
@@ -224,4 +242,5 @@ void Init_statement(void)
|
|
224
242
|
|
225
243
|
rb_define_method(cStatement, "bind", statement_bind, 1);
|
226
244
|
rb_define_method(cStatement, "page_size=", statement_page_size, 1);
|
245
|
+
rb_define_method(cStatement, "idempotent=", statement_idempotent, 1);
|
227
246
|
}
|
data/ilios.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.metadata['homepage_uri'] = spec.homepage
|
20
20
|
spec.metadata['source_code_uri'] = 'https://github.com/Watson1978/ilios'
|
21
21
|
spec.metadata['bug_tracker_uri'] = 'https://github.com/Watson1978/ilios/issues'
|
22
|
-
spec.metadata['documentation_uri'] =
|
22
|
+
spec.metadata['documentation_uri'] = "https://www.rubydoc.info/gems/ilios/#{Ilios::VERSION}"
|
23
23
|
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
24
24
|
spec.metadata['rubygems_mfa_required'] = 'true'
|
25
25
|
|
@@ -28,11 +28,12 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.files =
|
29
29
|
Dir.chdir(__dir__) do
|
30
30
|
`git ls-files -z`.split("\x0").reject do |f|
|
31
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:test|example)/|\.(?:git|editorconfig|rubocop.*))})
|
31
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:test|dockerfiles|example)/|\.(?:git|editorconfig|rubocop.*))})
|
32
32
|
end
|
33
33
|
end
|
34
34
|
spec.require_paths = ['lib']
|
35
35
|
spec.extensions << 'ext/ilios/extconf.rb'
|
36
36
|
|
37
37
|
spec.add_runtime_dependency('mini_portile2', '~> 2.8')
|
38
|
+
spec.add_runtime_dependency('native-package-installer', '~> 1.1')
|
38
39
|
end
|
data/lib/ilios/version.rb
CHANGED
data/sig/ilios.rbs
CHANGED
@@ -1,4 +1,40 @@
|
|
1
1
|
module Ilios
|
2
2
|
VERSION: String
|
3
|
-
|
3
|
+
|
4
|
+
module Cassandra
|
5
|
+
def self.config=: (Hash[Symbol, untyped]) -> void
|
6
|
+
def self.session: () -> Ilios::Cassandra::Session
|
7
|
+
def self.connect: () -> Ilios::Cassandra::Session
|
8
|
+
|
9
|
+
class Session
|
10
|
+
def prepare_async: (String) -> Ilios::Cassandra::Future
|
11
|
+
def prepare: (String) -> Ilios::Cassandra::Statement
|
12
|
+
|
13
|
+
def execute_async: (Ilios::Cassandra::Statement) -> Ilios::Cassandra::Future
|
14
|
+
def execute: (Ilios::Cassandra::Statement) -> Ilios::Cassandra::Result
|
15
|
+
end
|
16
|
+
|
17
|
+
class Statement
|
18
|
+
def bind: (Hash[Symbol, untyped] | Hash[String, untyped]) -> self
|
19
|
+
def page_size=: (Integer) -> self
|
20
|
+
def idempotent=: (true | false) -> self
|
21
|
+
end
|
22
|
+
|
23
|
+
class Future
|
24
|
+
def on_success: () { (Ilios::Cassandra::Result) -> void } -> self
|
25
|
+
def on_failure: () { () -> void } -> self
|
26
|
+
def await: () -> Ilios::Cassandra::Future
|
27
|
+
end
|
28
|
+
|
29
|
+
class Result
|
30
|
+
type row_type = Hash[String, untyped]
|
31
|
+
|
32
|
+
include Enumerable[row_type]
|
33
|
+
|
34
|
+
def each: () { (row_type) -> void } -> void |
|
35
|
+
() -> ::Enumerator[row_type, self]
|
36
|
+
def next_page: () -> Ilios::Cassandra::Result |
|
37
|
+
() -> nil
|
38
|
+
end
|
39
|
+
end
|
4
40
|
end
|
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
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Watson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mini_portile2
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: native-package-installer
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.1'
|
27
41
|
description: Cassandra driver written by C language
|
28
42
|
email:
|
29
43
|
- watson1978@gmail.com
|
@@ -33,7 +47,6 @@ extensions:
|
|
33
47
|
extra_rdoc_files: []
|
34
48
|
files:
|
35
49
|
- ".yardopts"
|
36
|
-
- Dockerfile
|
37
50
|
- Gemfile
|
38
51
|
- README.md
|
39
52
|
- Rakefile
|
@@ -58,7 +71,7 @@ metadata:
|
|
58
71
|
homepage_uri: https://github.com/Watson1978/ilios
|
59
72
|
source_code_uri: https://github.com/Watson1978/ilios
|
60
73
|
bug_tracker_uri: https://github.com/Watson1978/ilios/issues
|
61
|
-
documentation_uri: https://www.rubydoc.info/gems/ilios
|
74
|
+
documentation_uri: https://www.rubydoc.info/gems/ilios/0.3.1
|
62
75
|
rubygems_mfa_required: 'true'
|
63
76
|
post_install_message:
|
64
77
|
rdoc_options: []
|
data/Dockerfile
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
FROM ubuntu:22.04
|
2
|
-
|
3
|
-
RUN apt update && \
|
4
|
-
apt install -y tzdata sudo && \
|
5
|
-
apt install -y curl cmake make gcc g++ git bzip2 zlib1g-dev libgdbm-dev libreadline-dev libffi-dev libssl-dev libyaml-dev && \
|
6
|
-
git clone --depth 1 https://github.com/rbenv/ruby-build.git && \
|
7
|
-
cd ruby-build/bin && ./ruby-build 3.0.6 /usr/local
|
8
|
-
|
9
|
-
WORKDIR /opt/ilios
|