Skip to content

igorcoding/EV-Tarantool16

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

master Travis CI Build status (master)

NAME

EV::Tarantool16 - EV client for Tarantool 1.6

VESRION

Version 1.39

SYNOPSIS

use EV::Tarantool16;
my $c; $c = EV::Tarantool16->new({
    host => '127.0.0.1',
    port => 3301,
    username => 'test_user',
    password => 'test_passwd',
    reconnect => 0.2,
    connected => sub {
        warn "connected: @_";
        EV::unloop;
    },
    connfail => sub {
        warn "connfail: @_ / $!";
        EV::unloop;
    },
    disconnected => sub {
        warn "discon: @_ / $!";
        EV::unloop;
    },
});

$c->connect;
EV::loop;

$c->ping(sub {
    my $a = @_[0];
    diag Dumper \@_ if !$a;
    EV::unloop;
});
EV::loop;

SUBROUTINES/METHODS

new {option => value,...}

Create new EV::Tarantool16 instance.

host => $address

Address connect to.

port => $port

Port connect to.

username => $username

Username.

password => $password

Password.

reconnect => $reconnect

Reconnect timeout.

log_level => $log_level

Logging level. Values: (0: None), (1: Error), (2: Warning), (3: Info), (4: Debug)

cnntrace => $cnntrace

Enable (1) or disable(0) evcnn tracing.

ares_reuse => $ares_reuse

Enable (1) or disable(0) c-ares connection reuse (default = 0).

wbuf_limit => $wbuf_limit

Write vector buffer length limit. Defaults to 16384. Set wbuf_limit = 0 to disable write buffer length check on every request.

connected => $sub

Called when connection to Tarantool 1.6 instance is established, authenticated successfully and retrieved spaces information from it.

connfail => $sub

Called when connection to Tarantool 1.6 instance failed.

disconnected => $sub

Called when Tarantool 1.6 instance disconnected.

connect

Connect to Tarantool 1.6 instance. EV::Tarantool16->connected is called when connection is established.

disconnect

Disconnect from Tarantool 1.6 instance. EV::Tarantool16->disconnected is called afterwards.

ping $opts, $cb->($result)

Execute ping request

$opts

HASHREF of additional options to the request

timeout => $timeout

Request execution timeout

eval $lua_expression, $tuple_args, $opts, $cb->($result)

Execute eval request

$lua_expression

Lua code that will be run in tarantool

tuple_args

Tuple (ARRAYREF) that will be passed as argument in lua code

$opts

HASHREF of additional options to the request

timeout => $timeout

Request execution timeout

space => $space

This space definition will be used to decode response tuple

in => $in

Format for parsing input (string). One char is for one argument ('s' = string, 'n' = number, 'a' = array, '*' = anything (type is determined automatically))

call $function_name, $tuple_args, $opts, $cb->($result)

Execute eval request

$function_name

Lua function that will be called in tarantool

tuple_args

Tuple (ARRAYREF) that will be passed as argument in lua code

$opts

HASHREF of additional options to the request

timeout => $timeout

Request execution timeout

space => $space

This space definition will be used to decode response tuple

in => $in

Format for parsing input (string). One char is for one argument ('s' = string, 'n' = number, 'a' = array, '*' = anything (type is determined automatically))

select $space_name, $keys, $opts, $cb->($result)

Execute select request

$space_name

Tarantool space name.

$keys

Select keys (ARRAYREF or HASHREF).

$opts

HASHREF of additional options to the request

timeout => $timeout

Request execution timeout

hash => $hash

Use hash as result

index => $index

Index name or id to use

limit => $limit

Select limit

offset => $offset

Select offset

iterator => $iterator

Select iterator type. It is recommended to use the predefined constants EV::Tarantool16::INDEX_#iterator_name# (eg. EV::Tarantool16::INDEX_EQ, EV::Tarantool16::INDEX_GE and so on).

List of possible iterator names:

  • EQ

  • REQ

  • ALL

  • LT

  • LE

  • GE

  • GT

  • BITS_ALL_SET

  • BITS_ANY_SET

  • BITS_ALL_NOT_SET

  • OVERLAPS

  • NEIGHBOR

You can also use string names as the value to this option (like 'EQ' or 'LT').

in => $in

Format for parsing input (string). One char is for one argument ('s' = string, 'n' = number, 'a' = array, '*' = anything (type is determined automatically))

insert $space_name, $tuple, $opts, $cb->($result)

Execute insert request

$space_name

Tarantool space name.

$tuple

Tuple to be inserted (ARRAYREF or HASHREF).

$opts

HASHREF of additional options to the request

timeout => $timeout

Request execution timeout

hash => $hash

Use hash as result

replace => $replace

Insert(0) or replace(1) a tuple

in => $in

Format for parsing input (string). One char is for one argument ('s' = string, 'n' = number, 'a' = array, '*' = anything (type is determined automatically))

replace $space_name, $tuple, $opts, $cb->($result)

Execute replace request (same as insert, but replaces tuple if already exists). ($opts->{replace} = 1)

update $space_name, $key, $operations, $opts, $cb->($result)

Execute update request

$space_name

Tarantool space name.

$key

Select key where to perform update (ARRAYREF or HASHREF).

$operations

Update operations (ARRAYREF) in this format: [$field_no => $operation, $operation_args] Please refer to Tarantool 1.6 documentaion for more details.

$opts

HASHREF of additional options to the request

timeout => $timeout

Request execution timeout

hash => $hash

Use hash as result

index => $index

Index name or id to use

in => $in

Format for parsing input (string). One char is for one argument ('s' = string, 'n' = number, 'a' = array, '*' = anything (type is determined automatically))

upsert $space_name, $tuple, $operations, $opts, $cb->($result)

Execute upsert request

$space_name

Tarantool space name.

$tuple

A tuple that will be inserted to Tarantool if there is no tuple like it already (ARRAYREF or HASHREF).

$operations

Update operations (ARRAYREF) in this format: [$field_no => $operation, $operation_args] Please refer to Tarantool 1.6 documentaion for more details.

$opts

HASHREF of additional options to the request

timeout => $timeout

Request execution timeout

hash => $hash

Use hash as result

in => $in

Format for parsing input (string). One char is for one argument ('s' = string, 'n' = number, 'a' = array, '*' = anything (type is determined automatically))

delete $space_name, $key, $opts, $cb->($result)

Execute delete request

$space_name

Tarantool space name.

$key

Select key (ARRAYREF or HASHREF).

$opts

HASHREF of additional options to the request

timeout => $timeout

Request execution timeout

hash => $hash

Use hash as result

index => $index

Index name or id to use

in => $in

Format for parsing input (string). One char is for one argument ('s' = string, 'n' = number, 'a' = array, '*' = anything (type is determined automatically))

lua $function_name, $args, $opts, $cb->($result)

Execute call request (added for backward compatibility with EV::Tarantool). See 'call' method.

stats $cb->($result)

Get Tarantool stats

Result

Returns a HASHREF, consisting of the following data:

arena
size

Arena allocated size

used

Arena used size

slabs

Slabs memory use

info
lsn

Tarantool log sequence number

lut

Last update time (current_time - box_info.replication.idle)

lag

Replication lag

pid

Process pid

uptime

Server's uptime

op

Total operations count for each operation (select, insert, ...)

space

Tuples count in each space

RESULT

Success result

count => 1,
tuples => [
            {
              _t1 => 'tt1',
              _t2 => 'tt2',
              _t3 => 456,
              _t4 => 5
            }
          ],
status => 'ok',
code => 0,
sync => 5
count

Tuples count

tuples

Tuples themeselves

status

Status string ('ok')

code

Return code (0 if ok, else error code (https://github.com/tarantool/tarantool/blob/master/src/box/errcode.h))

sync

Request id

Error result

[undef, $error_msg, {
    errstr => $error_msg,
    status => 'error',
    code => $error_code,
    sync => 3
}]
errstr

Error string

status

Status string ('error')

code

Return code (0 if ok, else error code (https://github.com/tarantool/tarantool/blob/master/src/box/errcode.h))

sync

Request id

AUTHOR

igorcoding, <igorcoding@gmail.com>, Mons Anderson, <mons@cpan.org>

BUGS

Please report any bugs or feature requests in https://github.com/igorcoding/EV-Tarantool16/issues

COPYRIGHT AND LICENSE

Copyright (C) 2015 by igorcoding

This program is released under the following license: GPL

Packages

No packages published

Contributors 3

  •  
  •  
  •  
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy