.\" 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::LLClient 3pm" .TH DR::Tarantool::LLClient 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::LLClient \- a low level async client for Tarantool .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 8 \& DR::Tarantool::LLClient\->connect( \& host => \*(Aq127.0.0.1\*(Aq, \& port => \*(Aq33033\*(Aq, \& cb => { \& my ($tnt) = @_; \& ... \& } \& ); \& \& $tnt\->ping( sub { .. } ); \& $tnt\->insert(0, [ 1, 2, 3 ], sub { ... }); \& $tnt\->select(1, 0, [ [ 1, 2 ], [ 3, 4 ] ], sub { ... }); \& $tnt\->update(0, [ 1 ], [ [ 1 => add pack \*(AqL<\*(Aq, 1 ] ], sub { ... }); \& $tnt\->call_lua( \*(Aqbox.select\*(Aq, [ 0, 1, 2 ], sub { ... }); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module provides a low-level interface to Tarantool . .SH "METHODS" .IX Header "METHODS" All methods receive \fBcallback\fR as the last argument. The callback receives \&\fB\s-1HASHREF\s0\fR value with the following fields: .IP "status" 4 .IX Item "status" Done status: .RS 4 .IP "fatal" 4 .IX Item "fatal" A fatal error occurred. The server closed the connection or returned a broken package. .IP "buffer" 4 .IX Item "buffer" An internal driver error. .IP "error" 4 .IX Item "error" The request wasn't executed: the server returned an error. .IP "ok" 4 .IX Item "ok" Request was executed \s-1OK.\s0 .RE .RS 4 .RE .IP "errstr" 4 .IX Item "errstr" If an error occurred, contains error description. .IP "code" 4 .IX Item "code" Contains reply code. .IP "req_id" 4 .IX Item "req_id" Contains request id. (see protocol documentation ) .IP "type" 4 .IX Item "type" Contains request type (see protocol documentation ) .IP "count" 4 .IX Item "count" Contains the count of returned tuples. .IP "tuples" 4 .IX Item "tuples" Returned tuples (\fB\s-1ARRAYREF\s0\fR of \fB\s-1ARRAYREF\s0\fR). .PP If you use \fB\s-1NUM\s0\fR or \fB\s-1NUM64\s0\fR field types, values for these fields need to be packed before they are sent to the server, and unpacked when received in a response. This is a low-level driver :) .SS "connect" .IX Subsection "connect" Creates a connection to Tarantool .PP .Vb 8 \& DR::Tarantool::LLClient\->connect( \& host => \*(Aq127.0.0.1\*(Aq, \& port => \*(Aq33033\*(Aq, \& cb => { \& my ($tnt) = @_; \& ... \& } \& ); .Ve .PP \fIArguments\fR .IX Subsection "Arguments" .IP "host & port" 4 .IX Item "host & port" Host and port to connect to. .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 \&\fBImportant\fR: the driver does not reconnect after \fBthe first\fR unsuccessful connection. It calls \fBcallback\fR instead. .IP "reconnect_always" 4 .IX Item "reconnect_always" Try to reconnect even after the first unsuccessful connection. .IP "cb" 4 .IX Item "cb" Done callback. The callback receives a connection handle connected to the server or an error string. .SS "is_connected" .IX Subsection "is_connected" \&\fBTrue\fR if this connection is established. .SS "connection_status" .IX Subsection "connection_status" Contains a string with the status of connection. Return value can be: .IP "ok" 4 .IX Item "ok" Connection is established. .IP "not_connected" 4 .IX Item "not_connected" Connection isn't established yet, or was lost. .IP "connecting" 4 .IX Item "connecting" The driver is connecting to the server. .IP "fatal" 4 .IX Item "fatal" An attempt to connect was made, but ended up with an error. If the event loop is running, and \fBreconnect_period\fR option is set, the driver continues to try to reconnect and update its status. .SS "ping" .IX Subsection "ping" Ping the server. .PP .Vb 1 \& $tnt\->ping( sub { .. } ); .Ve .PP \fIArguments\fR .IX Subsection "Arguments" .IP "a callback" 4 .IX Item "a callback" .SS "insert" .IX Subsection "insert" Insert a tuple. .PP .Vb 2 \& $tnt\->insert(0, [ 1, 2, 3 ], sub { ... }); \& $tnt\->insert(0, [ 4, 5, 6 ], $flags, sub { .. }); .Ve .PP \fIArguments\fR .IX Subsection "Arguments" .IP "space" 4 .IX Item "space" .PD 0 .IP "tuple" 4 .IX Item "tuple" .IP "flags (optional)" 4 .IX Item "flags (optional)" .IP "callback" 4 .IX Item "callback" .PD .SS "select" .IX Subsection "select" Select a tuple or tuples. .PP .Vb 3 \& $tnt\->select(1, 0, [ [ 1, 2 ], [ 3, 4 ] ], sub { ... }); \& $tnt\->select(1, 0, [ [ 1, 2 ], [ 3, 4 ] ], 1, sub { ... }); \& $tnt\->select(1, 0, [ [ 1, 2 ], [ 3, 4 ] ], 1, 2, sub { ... }); .Ve .PP \fIArguments\fR .IX Subsection "Arguments" .IP "space" 4 .IX Item "space" .PD 0 .IP "index" 4 .IX Item "index" .IP "tuple_keys" 4 .IX Item "tuple_keys" .IP "limit (optional)" 4 .IX Item "limit (optional)" .PD If the limit isn't set or is zero, select extracts all records without a limit. .IP "offset (optional)" 4 .IX Item "offset (optional)" Default value is \fB0\fR. .IP "callback for results" 4 .IX Item "callback for results" .SS "update" .IX Subsection "update" Update a tuple. .PP .Vb 9 \& $tnt\->update(0, [ 1 ], [ [ 1 => add 1 ] ], sub { ... }); \& $tnt\->update( \& 0, # space \& [ 1 ], # key \& [ [ 1 => add 1 ], [ 2 => add => 1 ], # operations \& $flags, # flags \& sub { ... } # callback \& ); \& $tnt\->update(0, [ 1 ], [ [ 1 => add 1 ] ], $flags, sub { ... }); .Ve .PP \fIArguments\fR .IX Subsection "Arguments" .IP "space" 4 .IX Item "space" .PD 0 .IP "tuple_key" 4 .IX Item "tuple_key" .IP "operations list" 4 .IX Item "operations list" .IP "flags (optional)" 4 .IX Item "flags (optional)" .IP "callback for results" 4 .IX Item "callback for results" .PD .SS "delete" .IX Subsection "delete" Delete a tuple. .PP .Vb 2 \& $tnt\->delete( 0, [ 1 ], sub { ... }); \& $tnt\->delete( 0, [ 1 ], $flags, sub { ... }); .Ve .PP \fIArguments\fR .IX Subsection "Arguments" .IP "space" 4 .IX Item "space" .PD 0 .IP "tuple_key" 4 .IX Item "tuple_key" .IP "flags (optional)" 4 .IX Item "flags (optional)" .IP "callback for results" 4 .IX Item "callback for results" .PD .SS "call_lua" .IX Subsection "call_lua" Calls a lua procedure. .PP .Vb 2 \& $tnt\->call_lua( \*(Aqbox.select\*(Aq, [ 0, 1, 2 ], sub { ... }); \& $tnt\->call_lua( \*(Aqbox.select\*(Aq, [ 0, 1, 2 ], $flags, sub { ... }); .Ve .PP \fIArguments\fR .IX Subsection "Arguments" .IP "name of the procedure" 4 .IX Item "name of the procedure" .PD 0 .IP "tuple_key" 4 .IX Item "tuple_key" .IP "flags (optional)" 4 .IX Item "flags (optional)" .IP "callback to call when the request is ready" 4 .IX Item "callback to call when the request is ready" .PD .SS "last_code" .IX Subsection "last_code" Return code of the last request or \fBundef\fR if there was no request. .SS "last_error_string" .IX Subsection "last_error_string" An error string if the last request ended up with an error, or \fBundef\fR otherwise. .SH "Logging" .IX Header "Logging" The module can log requests/responses. Logging can be turned \s-1ON\s0 by setting these environment variables: .IP "\s-1TNT_LOG_DIR\s0" 4 .IX Item "TNT_LOG_DIR" Instructs LLClient to record all requests/responses into this directory. .IP "\s-1TNT_LOG_ERRDIR\s0" 4 .IX Item "TNT_LOG_ERRDIR" Instructs LLClient to record all requests/responses which ended up with an error into this directory. .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" .Vb 2 \& Copyright (C) 2011 Dmitry E. Oboukhov \& Copyright (C) 2011 Roman V. Nikolaev \& \& This program is free software, you can redistribute it and/or \& modify it under the terms of the Artistic License. .Ve .SH "VCS" .IX Header "VCS" The project is placed git repo on github: .