GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  DR::TARANTOOL::LLCLIENT (3)

.ds Aq ’

NAME

DR::Tarantool::LLClient - a low level async client for Tarantool <http://tarantool.org>

CONTENTS

SYNOPSIS



    DR::Tarantool::LLClient->connect(
        host => 127.0.0.1,
        port => 33033,
        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 L<, 1 ] ], sub { ... });
    $tnt->call_lua( box.select, [ 0, 1, 2 ], sub { ... });



DESCRIPTION

This module provides a low-level interface to Tarantool <http://tarantool.org>.

METHODS

All methods receive <B>callbackB> as the last argument. The callback receives <B>HASHREFB> value with the following fields:
status Done status:
fatal A fatal error occurred. The server closed the connection or returned a broken package.
buffer An internal driver error.
error The request wasn’t executed: the server returned an error.
ok Request was executed OK.
errstr If an error occurred, contains error description.
code Contains reply code.
req_id Contains request id. (see protocol documentation <https://github.com/mailru/tarantool/blob/master/doc/box-protocol.txt>)
type Contains request type (see protocol documentation <https://github.com/mailru/tarantool/blob/master/doc/box-protocol.txt>)
count Contains the count of returned tuples.
tuples Returned tuples (<B>ARRAYREFB> of <B>ARRAYREFB>).
If you use <B>NUMB> or <B>NUM64B> 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 :)

    connect

Creates a connection to Tarantool



    DR::Tarantool::LLClient->connect(
        host => 127.0.0.1,
        port => 33033,
        cb   => {
            my ($tnt) = @_;
            ...
        }
    );



Arguments
host & port Host and port to connect to.
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.

<B>ImportantB>: the driver does not reconnect after <B>the firstB> unsuccessful connection. It calls <B>callbackB> instead.

reconnect_always Try to reconnect even after the first unsuccessful connection.
cb Done callback. The callback receives a connection handle connected to the server or an error string.

    is_connected

<B>TrueB> if this connection is established.

    connection_status

Contains a string with the status of connection. Return value can be:
ok Connection is established.
not_connected Connection isn’t established yet, or was lost.
connecting The driver is connecting to the server.
fatal An attempt to connect was made, but ended up with an error. If the event loop is running, and <B>reconnect_periodB> option is set, the driver continues to try to reconnect and update its status.

    ping

Ping the server.



    $tnt->ping( sub { .. } );



Arguments
a callback

    insert

Insert a tuple.



    $tnt->insert(0, [ 1, 2, 3 ], sub { ... });
    $tnt->insert(0, [ 4, 5, 6 ], $flags, sub { .. });



Arguments
space
tuple
flags (optional)
callback

    select

Select a tuple or tuples.



    $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 { ... });



Arguments
space
index
tuple_keys
limit (optional) If the limit isn’t set or is zero, select extracts all records without a limit.
offset (optional) Default value is <B>0B>.
callback for results

    update

Update a tuple.



    $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 { ... });



Arguments
space
tuple_key
operations list
flags (optional)
callback for results

    delete

Delete a tuple.



    $tnt->delete( 0, [ 1 ], sub { ... });
    $tnt->delete( 0, [ 1 ], $flags, sub { ... });



Arguments
space
tuple_key
flags (optional)
callback for results

    call_lua

Calls a lua procedure.



    $tnt->call_lua( box.select, [ 0, 1, 2 ], sub { ... });
    $tnt->call_lua( box.select, [ 0, 1, 2 ], $flags, sub { ... });



Arguments
name of the procedure
tuple_key
flags (optional)
callback to call when the request is ready

    last_code

Return code of the last request or <B>undefB> if there was no request.

    last_error_string

An error string if the last request ended up with an error, or <B>undefB> otherwise.

Logging

The module can log requests/responses. Logging can be turned ON by setting these environment variables:
TNT_LOG_DIR Instructs LLClient to record all requests/responses into this directory.
TNT_LOG_ERRDIR Instructs LLClient to record all requests/responses which ended up with an error into this directory.

COPYRIGHT AND LICENSE



 Copyright (C) 2011 Dmitry E. Oboukhov <unera@debian.org>
 Copyright (C) 2011 Roman V. Nikolaev <rshadow@rambler.ru>

 This program is free software, you can redistribute it and/or
 modify it under the terms of the Artistic License.



VCS

The project is placed git repo on github: <https://github.com/dr-co/dr-tarantool/>.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 DR::TARANTOOL::LLCLIENT (3) 2014-06-16

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.