DR-Tnt

 view release on metacpan or  search on metacpan

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

=head2 tarantool

Loads selected driver and returns connector.

You can choose one driver:

=over

=item sync

L<DR::Tnt::Client::Sync> will be loaded and created.

=item ae or async

L<DR::Tnt::Client::AE> will be loaded and created.

=item coro

L<DR::Tnt::Client::Coro> will be loaded and created.

=back


=head2 Attributes

=over

=item host, port

Connection point for tarantool instance. If host contains C<unix/>, port
have to contain valid unix path to opened socket.

=item user, password

Auth arguments.

=item lua_dir

Directory that contains some lua files. After connecting, the driver sends
L<$tnt->eval_lua> for each file in the directory. So You can use the mechanizm
to store some values to C<box.session.storage>.

=item hashify_tuples

If the option is set to C<TRUE>, then the driver will extract tuples
to hash by C<box.space._space> schema.

=item reconnect_interval

Internal to reconnect after disconnect or fatal errors. Undefined value
disables the mechanizm.

=item raise_error

The option is actual for C<coro> and C<sync> drivers
(L<DR::Tnt::Client::Coro> and L<DR::Tnt::Client::Sync>).

=item utf8

Default value is C<TRUE>. If C<TRUE>, driver will unpack all
strings as C<utf8>-decoded strings.

=back

=head2 Information attributes

=over

=item last_error

Contains array of last error.
If there was no errors, the attrubute contains C<undef>.

The array can contain two or three elements:

=over

=item *

String error identifier. Example: C<ER_SOCKET> or C<ER_REQUEST>.

=item *

Error message. Example: 'C<Connection timeout>'

=item *

Tarantool code. Optional parameter. Example C<0x806D>.
The code is present only for tarantool errors (like lua error, etc).

=back

=back

=head1 CONNECTORS METHODS

All connectors have the same API. AnyEvent's connector has the last
argument - callback for results.

If C<raise_error> is C<false>, C<coro> and C<sync> drivers will
return C<undef> and store C<last_error>. Any successfuly call clears
C<last_error> attribute.

=over
    
=item auth

    # auth by $tnt->user and $tnt->password
    if ($tnt->auth) {

    }

    if ($tnt->auth($user, $password) {

    }

Auth user in tarantool. Note: The driver uses
C<<$tnt->user>> and C<<$tnt->password>> attributes after reconnects.

=item select



( run in 0.960 second using v1.01-cache-2.11-cpan-bbe5e583499 )