lwtarantool 0.0.2 → 0.0.3
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/ext/lwtarantool/conn.c +28 -2
- data/ext/lwtarantool/errors.c +2 -0
- data/ext/lwtarantool/lwtarantool.h +1 -0
- data/lib/lwtarantool/connection.rb +1 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab63cfa8741750b2251ba60df2ac2a7fd993776f
|
4
|
+
data.tar.gz: 8d7bfe89af4560f6e4669e6dbe75a6279a9a9d1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a8573ef486d4bb5e45c8fe3f864a7b42448823de3d9bdec26538554c4b89649a4a74a3fc52946f43d6b92be930e599e1e900ced3f17b955f6d6a3dd16e93a23
|
7
|
+
data.tar.gz: 6011994dee0bf850ab0c013d87a3d7c0a7bbbfbc6617de09b9b884a25cee6cd4cb3bbd7ecf4e5acae403763571d8cdc533bb7bc9fe8ab9b7ba5e3851a6778da0
|
data/ext/lwtarantool/conn.c
CHANGED
@@ -82,8 +82,10 @@ lwt_conn_raise_error(lwt_conn_t *conn) {
|
|
82
82
|
case TNT_ESYSTEM:
|
83
83
|
rb_raise(lwt_eSystemError, tnt_strerror(conn->tnt));
|
84
84
|
break;
|
85
|
-
case TNT_EFAIL:
|
86
85
|
case TNT_EBIG:
|
86
|
+
rb_raise(lwt_eTooLargeRequestError, tnt_strerror(conn->tnt));
|
87
|
+
break;
|
88
|
+
case TNT_EFAIL:
|
87
89
|
default:
|
88
90
|
rb_raise(lwt_eUnknownError, tnt_strerror(conn->tnt));
|
89
91
|
break;
|
@@ -119,6 +121,8 @@ lwt_conn_disconnect(VALUE self) {
|
|
119
121
|
*
|
120
122
|
* @param [Hash] args the options to establish connection
|
121
123
|
* @option args [String] :url The tarantool address
|
124
|
+
* @option args [Integer] :recv_buf_size Receive buffer size (unknown effect)
|
125
|
+
* @option args [Integer] :send_buf_size Send buffer size (maximum request size)
|
122
126
|
*
|
123
127
|
* @example
|
124
128
|
* LWTarantool::Connection.new(url: 'tcp://127.0.0.1:3301')
|
@@ -144,6 +148,27 @@ lwt_conn_initialize(VALUE self, VALUE args) {
|
|
144
148
|
if (TYPE(args) != T_HASH)
|
145
149
|
rb_raise(rb_eArgError, "args must be a Hash");
|
146
150
|
|
151
|
+
// handle recv_buf_size option
|
152
|
+
val = rb_hash_aref(args, ID2SYM(rb_intern( "recv_buf_size")));
|
153
|
+
if (TYPE(val) != T_NIL) {
|
154
|
+
if (TYPE(val) != T_FIXNUM)
|
155
|
+
rb_raise(rb_eArgError, "recv_buf_size must be an Integer");
|
156
|
+
|
157
|
+
if (tnt_set(conn->tnt, TNT_OPT_RECV_BUF, rb_fix2uint(val)) != 0)
|
158
|
+
rb_raise(rb_eArgError, "invalid recv_buf_size value");
|
159
|
+
}
|
160
|
+
|
161
|
+
// handle send_buf_size option
|
162
|
+
val = rb_hash_aref(args, ID2SYM(rb_intern( "send_buf_size")));
|
163
|
+
if (TYPE(val) != T_NIL) {
|
164
|
+
if (TYPE(val) != T_FIXNUM)
|
165
|
+
rb_raise(rb_eArgError, "send_buf_size must be an Integer");
|
166
|
+
|
167
|
+
if (tnt_set(conn->tnt, TNT_OPT_SEND_BUF, rb_fix2uint(val)) != 0)
|
168
|
+
rb_raise(rb_eArgError, "invalid send_buf_size value");
|
169
|
+
}
|
170
|
+
|
171
|
+
// handle url option
|
147
172
|
val = rb_hash_aref(args, ID2SYM(rb_intern( "url")));
|
148
173
|
if (TYPE(val) != T_STRING)
|
149
174
|
rb_raise(rb_eArgError, "url must be a String");
|
@@ -153,7 +178,8 @@ lwt_conn_initialize(VALUE self, VALUE args) {
|
|
153
178
|
url[url_len] = '\0';
|
154
179
|
strncpy(url, RSTRING_PTR(val), url_len);
|
155
180
|
|
156
|
-
tnt_set(conn->tnt, TNT_OPT_URI, url)
|
181
|
+
if (tnt_set(conn->tnt, TNT_OPT_URI, url) != 0)
|
182
|
+
rb_raise(rb_eArgError, "invalid url value");
|
157
183
|
|
158
184
|
lwt_conn_connect(self);
|
159
185
|
|
data/ext/lwtarantool/errors.c
CHANGED
@@ -7,6 +7,7 @@ VALUE lwt_eResolvError = NULL;
|
|
7
7
|
VALUE lwt_eSyncError = NULL;
|
8
8
|
VALUE lwt_eSystemError = NULL;
|
9
9
|
VALUE lwt_eTimeoutError = NULL;
|
10
|
+
VALUE lwt_eTooLargeRequestError = NULL;
|
10
11
|
VALUE lwt_eUnknownError = NULL;
|
11
12
|
|
12
13
|
void init_errors() {
|
@@ -16,6 +17,7 @@ void init_errors() {
|
|
16
17
|
lwt_eSystemError = rb_define_class_under( lwt_Class, "SystemError", lwt_eError);
|
17
18
|
lwt_eResolvError = rb_define_class_under( lwt_Class, "ResolvError", lwt_eError);
|
18
19
|
lwt_eTimeoutError = rb_define_class_under( lwt_Class, "TimeoutError", lwt_eError);
|
20
|
+
lwt_eTooLargeRequestError = rb_define_class_under( lwt_Class, "TooLargeRequestError", lwt_eError);
|
19
21
|
lwt_eUnknownError = rb_define_class_under( lwt_Class, "UnknownError", lwt_eError);
|
20
22
|
|
21
23
|
//lwt_eLoginError = rb_define_class_under( lwt_Class, "LoginError", lwt_eError);
|
@@ -23,6 +23,7 @@ module LWTarantool
|
|
23
23
|
# @raise [LWTarantool::TimeoutError] connect timeout reached.
|
24
24
|
# @raise [LWTarantool::LoginError] incorrect login or password.
|
25
25
|
# @raise [LWTarantool::SystemError] connection failed.
|
26
|
+
# @raise [LWTarantool::TooLargeRequestError] request is larger than connection send buffer.
|
26
27
|
# @raise [LWTarantool::UnknownError] unknown error.
|
27
28
|
#
|
28
29
|
def call(func, args)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lwtarantool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Golovko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -156,9 +156,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
156
|
version: '0'
|
157
157
|
requirements: []
|
158
158
|
rubyforge_project:
|
159
|
-
rubygems_version: 2.2.
|
159
|
+
rubygems_version: 2.5.2.1
|
160
160
|
signing_key:
|
161
161
|
specification_version: 4
|
162
162
|
summary: Lightweight Tarantool client
|
163
163
|
test_files: []
|
164
|
-
has_rdoc:
|