DR::Tarantool::MsgPack::AsyncClient(3pm) | User Contributed Perl Documentation | DR::Tarantool::MsgPack::AsyncClient(3pm) |
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
Important: the driver does not reconnect after the first unsuccessful connection. It calls callback instead.
All methods accept callbacks which are invoked with the following arguments:
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:
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:
2018-11-02 | perl v5.28.0 |