DR-Tarantool

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

 -- Dmitry E. Oboukhov <unera@debian.org>  Tue, 10 Jul 2012 10:45:35 +0400

libdr-tarantool-perl (0.19-1) unstable; urgency=low

  * New upstream version: it is optimized for parallel requests.

 -- Dmitry E. Oboukhov <unera@debian.org>  Thu, 05 Jul 2012 23:50:03 +0400

libdr-tarantool-perl (0.18-1) unstable; urgency=low

  * HVs are created like perlxs: trying to be compatible with libcoro-perl.

 -- Dmitry E. Oboukhov <unera@debian.org>  Mon, 02 Jul 2012 10:12:39 +0400

libdr-tarantool-perl (0.17-2) unstable; urgency=low

  * Rebuilt for perl 5.14.

 -- Dmitry E. Oboukhov <unera@debian.org>  Fri, 29 Jun 2012 07:20:46 +0400

libdr-tarantool-perl (0.17-1) unstable; urgency=low

MANIFEST  view on Meta::CPAN

t/005-connection.t
t/010-xs.t
t/020-low_level_client.t
t/025-ll_synclient.t
t/030-spaces.t
t/033-iterator.t
t/040-tuple.t
t/050-async-client.t
t/060-sync-client.t
t/065-realsync-client.t
t/070-coro-client.t
t/080-tarantool.t
t/090-parallel-requests.t
t/1.6/015-msgpack-xs.t
t/1.6/017-msgpack-proto.t
t/1.6/022-msgpack-llclient.t
t/1.6/030-msgpack-async.t
t/1.6/040-msgpack-sync.t
t/1.6/050-msgpack-coro.t
t/1.6/data/ll-grant.lua
t/1.6/data/ll.lua
t/100-transform.t
t/110-netsplit-readahead.t
t/120-sessionid.t
t/130-reconnect.t
t/900-podspell.t
t/910-pod.t
t/920-critic.xt
t/test-data/00013-000-ok.bin

debian/changelog  view on Meta::CPAN

 -- Dmitry E. Oboukhov <unera@debian.org>  Tue, 10 Jul 2012 10:45:35 +0400

libdr-tarantool-perl (0.19-1) unstable; urgency=low

  * New upstream version: it is optimized for parallel requests.

 -- Dmitry E. Oboukhov <unera@debian.org>  Thu, 05 Jul 2012 23:50:03 +0400

libdr-tarantool-perl (0.18-1) unstable; urgency=low

  * HVs are created like perlxs: trying to be compatible with libcoro-perl.

 -- Dmitry E. Oboukhov <unera@debian.org>  Mon, 02 Jul 2012 10:12:39 +0400

libdr-tarantool-perl (0.17-2) unstable; urgency=low

  * Rebuilt for perl 5.14.

 -- Dmitry E. Oboukhov <unera@debian.org>  Fri, 29 Jun 2012 07:20:46 +0400

libdr-tarantool-perl (0.17-1) unstable; urgency=low

debian/control  view on Meta::CPAN

Standards-Version: 3.9.5
Priority: extra
VCS-Browser: https://github.com/dr-co/dr-tarantool

Package: libdr-tarantool-perl
Depends: ${perl:Depends}, ${misc:Depends}, ${shlibs:Depends},
 libanyevent-perl,
 libjson-xs-perl,
 libdevel-globaldestruction-perl,
 liblist-moreutils-perl
Recommends: libcoro-perl
Architecture: any
Suggests: tarantool
Description: perl driver for Tarantool
 The package contains sync and async drivers for tarantool database.

lib/DR/Tarantool.pm  view on Meta::CPAN

    my $tnt = tarantool
        host    => '127.0.0.1',
        port    => 123,
        spaces  => {
            ...
        }
    ;

    $tnt->update( ... );

    my $tnt = coro_tarantool
        host    => '127.0.0.1',
        port    => 123,
        spaces  => {
            ...
        }
    ;

    use DR::Tarantool ':constant', 'async_tarantool';

    async_tarantool

lib/DR/Tarantool.pm  view on Meta::CPAN

are returned to the caller, or, in case of an error, an
exception is thrown.

=item L<DR::Tarantool::CoroClient>

Is also built on top of L<DR::Tarantool::AsyncClient>, but is
designed to work in cooperative multitasking environment provided
by L<Coro>. Is fully syntax-compatible with
L<DR::Tarantool::SyncClient>, but requires a running event loop to
operate, like L<DR::Tarantool::AsyncClient>. Requests from
different coroutines are served concurrently.

=back

L<Tarantool|http://tarantool.org> binary protocol
contains no representation of database schema or tuple field types.
Due to this deficiency, to easily integrate with Perl and automatically
convert tuple fields to Perl values, the driver needs to know field names
and types. To tell the driver about them, an instance of a dedicated class
must be used.
L<DR::Tarantool::Spaces> is essentially a Perl hash which

lib/DR/Tarantool.pm  view on Meta::CPAN

use 5.008008;
use strict;
use warnings;
use Carp;
$Carp::Internal{ (__PACKAGE__) }++;

use base qw(Exporter);


our %EXPORT_TAGS = (
    client      => [ qw( tarantool async_tarantool coro_tarantool) ],
    constant    => [
        qw(
            TNT_INSERT TNT_SELECT TNT_UPDATE TNT_DELETE TNT_CALL TNT_PING
            TNT_FLAG_RETURN TNT_FLAG_ADD TNT_FLAG_REPLACE
        )
    ],
);

our @EXPORT_OK = ( map { @$_ } values %EXPORT_TAGS );
$EXPORT_TAGS{all} = \@EXPORT_OK;

lib/DR/Tarantool.pm  view on Meta::CPAN

sub async_tarantool {
    require DR::Tarantool::AsyncClient;
    no warnings 'redefine';
    *async_tarantool = sub {
        DR::Tarantool::AsyncClient->connect(@_);
    };
    goto \&async_tarantool;
}


=head2 coro_tarantol

connects to L<tarantool|http://tarantool.org> in async mode using
L<DR::Tarantool::CoroClient>.


=cut

sub coro_tarantool {
    require DR::Tarantool::CoroClient;
    no warnings 'redefine';
    *coro_tarantool = sub {
        DR::Tarantool::CoroClient->connect(@_);
    };
    goto \&coro_tarantool;
}


=head2 :constant

Exports constants to use in a client request as flags:

=over

=item TNT_FLAG_RETURN

lib/DR/Tarantool/CoroClient.pm  view on Meta::CPAN

use warnings;

package DR::Tarantool::CoroClient;
use base 'DR::Tarantool::AsyncClient';
use Coro;
use Carp;
use AnyEvent;

=head1 NAME

DR::Tarantool::CoroClient - an asynchronous coro driver for
L<Tarantool|http://tarantool.org>

=head1 SYNOPSIS

    use DR::Tarantool::CoroClient;
    use Coro;
    my $client = DR::Tarantool::CoroClient->connect(
        port    => $port,
        spaces  => $spaces;
    );

st/stress.pl  view on Meta::CPAN

sub tnt() {
    state (@process, $tnt);

    unless($tnt) {
        if (@process) {
            push @process => $Coro::current;
            Coro::schedule;

        } else {
            push @process => $Coro::current;
            $tnt = coro_tarantool
                    host        => '127.0.0.1',
                    port        => $tarantool->primary_port,
                    spaces => {
                        0 => {
                            name            => 'one_hash',
                            default_type    => 'STR',
                            fields  => [
                                'id',
                                'value',
                            ],

st/stress.pl  view on Meta::CPAN

                                    name    => 'driver',
                                    fields  => [ 'did', 'status' ]
                                },
                            }
                        },

                    }

            ;

            while(my $coro = shift @process) {
                next if $coro == $Coro::current;
                $coro->ready;
            }
        }

    }
    return $tnt;
}

sub error($$;@) {
    my ($cond, $name, @args) = @_;
    return $cond unless $cond;

st/stress.pl  view on Meta::CPAN

for (1 .. $forks // cfg 'forks') {
    my $pid = fork;
    unless ($pid) {
        @child = ();
        last;
    }
    push @child => $pid;
}


my $coro = $Coro::current;

$SIG{INT} = $SIG{TERM} = $SIG{__DIE__} = sub {
    if ($$ == $primary_pid) {
        $tarantool->kill('KILL') if $tarantool;
        df 'Exit loop';
        df '%s', $tarantool->log if $tarantool;
        kill TERM => $_ for @child;
    }
    error 1, 'Signal or exception was caught';
    $coro->ready;
    $coro->cede_to;
};


my @checks = glob catfile 'st', 'Check', '*.pm';
die "Can't find any check in st/Check" unless @checks;

for (@checks) {
    my $cname = basename $_ => '.pm';
    my $name = "Check::$cname";

st/stress.pl  view on Meta::CPAN

    async {
        eval { $name->start($tarantool, $primary_pid) };
        df 'Unexpected process "%s" shutdown: %s',
            $name, decode_utf8($@ // 'no errors');
        kill INT => $$;
    };
}

async {
    Coro::AnyEvent::sleep $timeout;
    $coro->ready;
};

Coro::schedule;

for (@child) {
    waitpid $_, 0;
    error $?, 'Child %s returns non-zero code: %s', $_, $?;
}

$tarantool->kill('KILL') if $$ ~~ $primary_pid;

t/080-tarantool.t  view on Meta::CPAN

                my ($status) = @_;
                is $status, 'ok', '* async_tarantool ping';
                $cv->send;
            }
        );
        $cv->recv;
    }

    eval "require Coro";
    skip "Coro isn't installed", 2 if $@;
    $client = coro_tarantool
        port    => $tnt->primary_port,
        spaces  => $spaces
    ;
    isa_ok $client => 'DR::Tarantool::CoroClient';
    ok $client->ping, '* coro_tarantool ping';
}

t/900-podspell.t  view on Meta::CPAN

github
repo
NUM
async
cb
errstr
lua
JSON
STR
UTF
coro
errorstr
destructor
ok
cfg
utf
happenned
ator
autoloads
iter
itemlist



( run in 0.370 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )