.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "DR::Tarantool::MsgPack::AsyncClient 3pm" .TH DR::Tarantool::MsgPack::AsyncClient 3pm "2019-10-07" "perl v5.30.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" DR::Tarantool::MsgPack::AsyncClient \- async client for tarantool. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use DR::Tarantool::MsgPack::AsyncClient; \& \& DR::Tarantool::MsgPack::AsyncClient\->connect( \& host => \*(Aq127.0.0.1\*(Aq, \& port => 12345, \& spaces => $spaces, \& sub { \& my ($client) = @_; \& } \& ); \& \& $client\->insert(\*(Aqspace_name\*(Aq, [1,2,3], sub { ... }); .Ve .SH "Class methods" .IX Header "Class methods" .SS "connect" .IX Subsection "connect" Connect to , returns (by callback) an object which can be used to make requests. .PP \fIArguments\fR .IX Subsection "Arguments" .IP "host & port & user & password" 4 .IX Item "host & port & user & password" Address and auth information of remote tarantool. .IP "space" 4 .IX Item "space" A hash with space description or a DR::Tarantool::Spaces reference. .IP "reconnect_period" 4 .IX Item "reconnect_period" An interval to wait before trying to reconnect after a fatal error or unsuccessful connect. If the field is defined and is greater than 0, the driver tries to reconnect to the server after this interval. .Sp Important: the driver does not reconnect after the first unsuccessful connection. It calls callback instead. .IP "reconnect_always" 4 .IX Item "reconnect_always" Try to reconnect even after the first unsuccessful connection. .SH "Worker methods" .IX Header "Worker methods" All methods accept callbacks which are invoked with the following arguments: .IP "status" 4 .IX Item "status" On success, this field has value 'ok'. The value of this parameter determines the contents of the rest of the callback arguments. .IP "a tuple or tuples or an error code" 4 .IX Item "a tuple or tuples or an error code" On success, the second argument contains tuple(s) produced by the request. On error, it contains the server error code. .IP "errorstr" 4 .IX Item "errorstr" Error string in case of an error. .Sp .Vb 9 \& sub { \& if ($_[0] eq \*(Aqok\*(Aq) { \& my ($status, $tuples) = @_; \& ... \& } else { \& my ($status, $code, $errstr) = @_; \& ... \& } \& } .Ve .SS "ping" .IX Subsection "ping" Ping the server. .PP .Vb 1 \& $client\->ping(sub { ... }); .Ve .SS "insert, replace" .IX Subsection "insert, replace" Insert/replace a tuple into a space. .PP .Vb 2 \& $client\->insert(\*(Aqspace\*(Aq, [ 1, \*(AqVasya\*(Aq, 20 ], sub { ... }); \& $client\->replace(\*(Aqspace\*(Aq, [ 2, \*(AqPetya\*(Aq, 22 ], sub { ... }); .Ve .SS "call_lua" .IX Subsection "call_lua" Call Lua function. .PP .Vb 1 \& $client\->call_lua(foo => [\*(Aqarg1\*(Aq, \*(Aqarg2\*(Aq], sub { }); .Ve .SS "select" .IX Subsection "select" Select a tuple (or tuples) from a space by index. .PP .Vb 1 \& $client\->select(\*(Aqspace_name\*(Aq, \*(Aqindex_name\*(Aq, [ \*(Aqkey\*(Aq ], %opts, sub { .. }); .Ve .PP Options can be: .IP "limit" 4 .IX Item "limit" .PD 0 .IP "offset" 4 .IX Item "offset" .IP "iterator" 4 .IX Item "iterator" .PD An iterator for index. Can be: .RS 4 .IP "\s-1ALL\s0" 4 .IX Item "ALL" Returns all tuples in space. .IP "\s-1EQ, GE, LE, GT, LT\s0" 4 .IX Item "EQ, GE, LE, GT, LT" .RE .RS 4 .RE .SS "delete" .IX Subsection "delete" Delete a tuple. .PP .Vb 1 \& $client\->delete(\*(Aqspace_name\*(Aq, [ \*(Aqkey\*(Aq ], sub { ... }); .Ve .SS "update" .IX Subsection "update" Update a tuple. .PP .Vb 1 \& $client\->update(\*(Aqspace\*(Aq, [ \*(Aqkey\*(Aq ], \e@ops, sub { ... }); .Ve .PP \&\f(CW@ops\fR is array of operations to update. Each operation is array of elements: .IP "code" 4 .IX Item "code" Code of operation: \f(CW\*(C`=\*(C'\fR, \f(CW\*(C`+\*(C'\fR, \f(CW\*(C`\-\*(C'\fR, \f(CW\*(C`&\*(C'\fR, \f(CW\*(C`|\*(C'\fR, etc .IP "field" 4 .IX Item "field" Field number or name. .IP "arguments" 4 .IX Item "arguments"