Class: LWTarantool::Request
- Inherits:
-
Object
- Object
- LWTarantool::Request
- Defined in:
- lib/lwtarantool/request.rb,
ext/lwtarantool/request.c,
ext/lwtarantool/request.c,
ext/lwtarantool/request.c,
ext/lwtarantool/request.c
Overview
Class for work with Tarantool requests
Instance Attribute Summary collapse
-
#conn ⇒ LWTarantool::Connection
readonly
Correspond tarantool connection.
Instance Method Summary collapse
-
#error ⇒ String?
Wait for request processing and return tarantool error message.
-
#id ⇒ Integer
Request id.
-
#ready? ⇒ Boolean
Check if request already processed.
-
#result ⇒ Array?
Wait for request processing and return tarantool reponse data.
-
#wait ⇒ Object
Wait for request be processed by Tarantool.
Instance Attribute Details
#conn ⇒ LWTarantool::Connection (readonly)
Correspond tarantool connection.
13 14 15 |
# File 'lib/lwtarantool/request.rb', line 13 def conn @conn end |
Instance Method Details
#error ⇒ String?
Wait for request processing and return tarantool error message.
53 54 55 56 |
# File 'lib/lwtarantool/request.rb', line 53 def error wait unless ready? _error end |
#id ⇒ Integer
Request id
51 52 53 54 55 56 57 |
# File 'ext/lwtarantool/request.c', line 51
static VALUE
lwt_request_id( VALUE self) {
lwt_request_t * req;
Data_Get_Struct(self, lwt_request_t, req);
return rb_uint2inum(req->id);
}
|
#ready? ⇒ Boolean
Check if request already processed.
64 65 66 67 68 69 70 71 72 73 |
# File 'ext/lwtarantool/request.c', line 64
static VALUE
lwt_request_is_ready( VALUE self) {
lwt_request_t * req;
Data_Get_Struct(self, lwt_request_t, req);
if (req->reply == NULL)
return Qfalse;
else
return Qtrue;
}
|
#result ⇒ Array?
Wait for request processing and return tarantool reponse data.
38 39 40 41 42 |
# File 'lib/lwtarantool/request.rb', line 38 def result wait unless ready? res = _result MessagePack.unpack(res) unless res.nil? end |
#wait ⇒ Object
Wait for request be processed by Tarantool.
25 26 27 |
# File 'lib/lwtarantool/request.rb', line 25 def wait conn.read until ready? end |