Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

dr::tarantool::spaces(3pm) [debian man page]

DR::Tarantool::Spaces(3pm)				User Contributed Perl Documentation				DR::Tarantool::Spaces(3pm)

NAME
DR::Tarantool::Spaces - spaces container SYNOPSIS
use DR::Tarantool::Spaces; my $s = new DR::Tarantool::Spaces({ 1 => { name => 'users', # space name default_type => 'STR', # undescribed fields fields => [ qw(login password role), { name => 'counter', type => 'NUM' }, { name => 'something', type => 'UTF8STR', }, { name => 'opts', type => 'JSON', } ], indexes => { 0 => 'login', 1 => [ qw(login password) ], 2 => { name => 'my_idx', fields => 'login', }, 3 => { name => 'my_idx2', fields => [ 'counter', 'something' ] } } }, 0 => { ... } }); my $f = $s->pack_field('users', 'counter', 10); my $f = $s->pack_field('users', 1, 10); # the same my $f = $s->pack_field(1, 1, 10); # the same my $ts = $s->pack_keys([1,2,3] => 'my_idx'); my $t = $s->pack_primary_key([1,2,3]); DESCRIPTION
The package describes all spaces that You use. It supports the following field types: NUM, NUM64, STR - standard tarantool <http://tarantool.org> types. UTF8STR - the same as STR, but string will be utf8-decoded after extracting from database. INT & INT64 - the same as NUM and NUM64, but contain signed values. JSON - the filed will be encoded by JSON::XS before inserting and decoded after extracting from database. METHODS
new my $spaces = DR::Tarantool::Spaces->new( $spaces ); space Returns space object by number or name. my $space = $spaces->space('name'); my $space = $spaces->space(0); pack_field packs one field before making database request my $field = $spaces->pack_field('space', 'field', $data); unpack_field unpacks one field after extracting data from database my $field = $spaces->unpack_field('space', 'field', $data); pack_tuple packs tuple before making database request my $t = $spaces->pack_tuple('space', [ 1, 2, 3 ]); unpack_tuple unpacks tuple after extracting data from database my $t = $spaces->unpack_tuple('space', @fields); SPACES methods new constructor use DR::Tarantool::Spaces; my $space = DR::Tarantool::Space->new($no, $space); name returns space name number returns space number pack_field packs field before making database request unpack_field unpacks field after extracting data from database pack_tuple packs tuple before making database request unpack_tuple unpacks tuple after extracting data from database 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/unera/dr-tarantool/ <https://github.com/unera/dr-tarantool/>. perl v5.14.2 2012-06-04 DR::Tarantool::Spaces(3pm)

Check Out this Related Man Page

DR::Tarantool::LLClient(3pm)				User Contributed Perl Documentation			      DR::Tarantool::LLClient(3pm)

NAME
DR::Tarantool::LLClient - low level async client for tarantool 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
The module provides low-level interface to tarantool <http://tarantool.org> METHODS
All methods receive callback as the last argument. The callback receives HASHREF value with the following fields: status Done status: fatal Fatal error was happenned. Server closed connection or returned broken package. buffer Internal driver error. error Request wasn't done: database returned error. ok Request was done. errstr If an error was happenned 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 count of returned tuples. tuples Contains returned tuples (ARRAYREF of ARRAYREF). If You use NUM or NUM64 values in database You have to pack them before requests and unpack them after response by hand. This is 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. reconnect_period Interval to reconnect after fatal errors or unsuccessful connects. If the field is defined and more than zero driver will try to reconnect server using this interval. Important: driver wont reconnect after the first unsuccessful connection. It will call callback instead. reconnect_always Constantly trying to reconnect even after the first unsuccessful connection. cb Done callback. The callback will receive a client instance that is already connected with server or error string. is_connected Returns TRUE if driver and server are connected with. connection_status Returns string that informs You about status of connection. Return value can be: ok Connection is established not_connected Connection isn't established yet, or was disconnected. connecting Driver tries connecting server fatal Driver tried connecting but receives an error. Driver can repeat connecting processes (see reconnect_period option). ping Pings tarantool. $tnt->ping( sub { .. } ); Arguments callback for results insert Inserts tuple. $tnt->insert(0, [ 1, 2, 3 ], sub { ... }); $tnt->insert(0, [ 4, 5, 6 ], $flags, sub { .. }); Arguments space tuple flags (optional) callback for results select Selects tuple(s). $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 limit isn't defined or zero select will extract all records without limit. offset (optional) Default value is 0. callback for results update Updates 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 Deletes tuple. $tnt->delete( 0, [ 1 ], sub { ... }); $tnt->delete( 0, [ 1 ], $flags, sub { ... }); Arguments space tuple_key flags (optional) callback for results call_lua calls lua function. $tnt->call_lua( 'box.select', [ 0, 1, 2 ], sub { ... }); $tnt->call_lua( 'box.select', [ 0, 1, 2 ], $flags, sub { ... }); Arguments name of function tuple_key flags (optional) callback for results 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/unera/dr-tarantool/ <https://github.com/unera/dr-tarantool/>. perl v5.14.2 2012-06-04 DR::Tarantool::LLClient(3pm)
Man Page