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
DR::Tarantool::MsgPack::AsyncClient(3) User Contributed Perl Documentation DR::Tarantool::MsgPack::AsyncClient(3)

DR::Tarantool::MsgPack::AsyncClient - async client for tarantool.

    use DR::Tarantool::MsgPack::AsyncClient;

    DR::Tarantool::MsgPack::AsyncClient->connect(
        host => '127.0.0.1',
        port => 12345,
        spaces => $spaces,
        sub {
            my ($client) = @_;
        }
    );

    $client->insert('space_name', [1,2,3], sub { ... });

Connect to <Tarantool:http://tarantool.org>, returns (by callback) an object which can be used to make requests.

Arguments

host & port & user & password
Address and auth information of remote tarantool.
space
A hash with space description or a DR::Tarantool::Spaces reference.
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.

Important: the driver does not reconnect after the first unsuccessful connection. It calls callback instead.

reconnect_always
Try to reconnect even after the first unsuccessful connection.

All methods accept callbacks which are invoked with the following arguments:
status
On success, this field has value 'ok'. The value of this parameter determines the contents of the rest of the callback arguments.
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.
errorstr
Error string in case of an error.

    sub {
        if ($_[0] eq 'ok') {
            my ($status, $tuples) = @_;
            ...
        } else {
            my ($status, $code, $errstr) = @_;
            ...
        }
    }
    

Ping the server.

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

Insert/replace a tuple into a space.

    $client->insert('space', [ 1, 'Vasya', 20 ], sub { ... });
    $client->replace('space', [ 2, 'Petya', 22 ], sub { ... });

Call Lua function.

    $client->call_lua(foo => ['arg1', 'arg2'], sub {  });

Select a tuple (or tuples) from a space by index.

    $client->select('space_name', 'index_name', [ 'key' ], %opts, sub { .. });

Options can be:

limit
offset
iterator
An iterator for index. Can be:
ALL
Returns all tuples in space.
EQ, GE, LE, GT, LT

Delete a tuple.

    $client->delete('space_name', [ 'key' ], sub { ... });

Update a tuple.

    $client->update('space', [ 'key' ], \@ops, sub { ... });

@ops is array of operations to update. Each operation is array of elements:

code
Code of operation: "=", "+", "-", "&", "|", etc
field
Field number or name.
arguments
2014-06-16 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

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