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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a10bfa0d8c43049eaff1705cb971ae461cca2bc
4
- data.tar.gz: d823ef8761beeb1f8f44babb0162891549c8e2af
3
+ metadata.gz: ab63cfa8741750b2251ba60df2ac2a7fd993776f
4
+ data.tar.gz: 8d7bfe89af4560f6e4669e6dbe75a6279a9a9d1d
5
5
  SHA512:
6
- metadata.gz: 69a06f61c2a266a33ec9a4f3bc40df1c12eeda7ee23caafa37d86bd3ffcdaac947aa55e65943ba9456ef6118738559e8e5a82c39339f30eac0181970933ae8b0
7
- data.tar.gz: 08d0f5c944dbf08a519b95ef625e6389356f58eeef0497fca8067bbada91facfe05f185aad213c033002b4c2c07402da251a4230339e6b98123d2052cb82847d
6
+ metadata.gz: 8a8573ef486d4bb5e45c8fe3f864a7b42448823de3d9bdec26538554c4b89649a4a74a3fc52946f43d6b92be930e599e1e900ced3f17b955f6d6a3dd16e93a23
7
+ data.tar.gz: 6011994dee0bf850ab0c013d87a3d7c0a7bbbfbc6617de09b9b884a25cee6cd4cb3bbd7ecf4e5acae403763571d8cdc533bb7bc9fe8ab9b7ba5e3851a6778da0
@@ -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
 
@@ -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);
@@ -15,6 +15,7 @@ extern VALUE lwt_eResolvError;
15
15
  extern VALUE lwt_eSyncError;
16
16
  extern VALUE lwt_eSystemError;
17
17
  extern VALUE lwt_eTimeoutError;
18
+ extern VALUE lwt_eTooLargeRequestError;
18
19
  extern VALUE lwt_eUnknownError;
19
20
 
20
21
 
@@ -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.2
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: 2018-05-03 00:00:00.000000000 Z
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.5
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: