Crate tarantool_rs

Source
Expand description

tarantool-rs - Asyncronous Tokio-based client for Tarantool.

This crate provide async connector and necessary abstractions for interaction with Tarantool instance.

§Example

use tarantool_rs::{Connection, ExecutorExt, IteratorType};

// Create connection to Tarantool instace
let conn = Connection::builder().build("127.0.0.1:3301").await?;

// Execute Lua code with one argument, returning this argument
let number: u64 = conn.eval("return ...", (42, )).await?.decode_result()?;
assert_eq!(number, 42);

// Call Lua function 'rand' (assuming it exists and return 42)
let number: u64 = conn.call("rand", ()).await?.decode_first()?;
assert_eq!(number, 42);

// Get 'clients' space with 2 fields - 'id' and 'name'
let clients_space = conn.space("clients").await?.expect("Space exists");

// Insert tuple into 'clients' space
clients_space.insert((1, "John Doe")).await?;

// Select tuples from clients space using primary index
let clients: Vec<(i64, String)> = clients_space
    .select(None, None, None, (1, ))
    .await?;

§Features

  • authorization
  • evaluating Lua expressions
  • remote function calling
  • CRUD operations
  • transaction control (begin/commit/rollback)
  • reconnection in background
  • SQL requests
  • chunked responses
  • watchers and events
  • connection pooling
  • automatic schema fetching and reloading
  • graceful shutdown protocol support
  • pre Tarantool 2.10 versions support
  • customizable connection features (streams/watchers/mvcc)
  • custom Tarantool MP types (UUID, …)

Modules§

errors
Errors module.
schema
Schema (spaces and indices) helper types.
utils
Various helpers.

Structs§

CallResponse
Tuple, returned from call and eval requests.
Connection
Connection to Tarantool instance.
ConnectionBuilder
Build connection to Tarantool.
DmoOperation
Operation in upsert or update request.
DmoResponse
Tuple, returned from all data-manipulation operations (insert, update, upsert, replace, delete).
PreparedSqlStatement
SqlResponse
Response, returned from SQL requests.
Stream
Abstraction, providing sequential processing of requests.
Transaction
Started transaction (docs).
TransactionBuilder
Build transaction.

Enums§

Error
Represents all possible errors of this crate.
IteratorType
Iterator type for select requests.
ReconnectInterval
Interval parameters for background reconnection.
TransactionIsolationLevel
Transaction isolation level.
Value
Represents any valid MessagePack value.

Traits§

Executor
Type, which can make requests to Tarantool and create streams and transactions.
ExecutorExt
Helper trait around Executor trait, which allows to send specific requests with any type, implementing Execitor trait.
Tuple
Trait, describing type, which can be encoded into MessagePack tuple.
TupleElement

Type Aliases§

Result
Alias for std::result::Result<T, crate::Error>.