Crate tarantool

Source
Expand description

Tarantool C API bindings for Rust. This library contains the following Tarantool API’s:

Caution! The library is currently under development. API may be unstable until version 1.0 is released.

§Features

  • net_box - Enables protocol implementation (enabled by default)
  • schema - Enables schema manipulation utils (WIP as for now)

§Prerequisites

  • rustc 1.67.1 or newer
  • tarantool 2.2

§Stored procedures

There are several ways Tarantool can call Rust code. It can use either a plugin, a Lua FFI module, or a stored procedure. In this file we only cover the third option, namely Rust stored procedures. Even though Tarantool always treats Rust routines just as “C functions”, we keep on using the “stored procedure” term as an agreed convention and also for historical reasons.

This tutorial contains the following simple steps:

  1. examples/easy - prints “hello world”;
  2. examples/harder - decodes a passed parameter value;
  3. examples/hardest - uses this library to do a DBMS insert;
  4. examples/read - uses this library to do a DBMS select;
  5. examples/write - uses this library to do a DBMS replace.

Our examples are a good starting point for users who want to confidently start writing their own stored procedures.

Re-exports§

pub use error::Result;
pub use tlua;
pub use linkme;

Modules§

auth
clock
The clock module returns time values derived from the Posix / C CLOCK_GETTIME function or equivalent.
coio
Cooperative input/output
datetime
define_str_enum
error
Error handling utils.
ffi
fiber
Сooperative multitasking module with optional async runtime.
index
Box: indices
log
Logging utils. See “log” crate documentation for details
msgpack
net_box
The net_box module contains connector to remote Tarantool server instances via a network.
network
Sans-I/O network client for connecting to remote Tarantool server.
proc
schema
sequence
Box: sequences
session
Box: session
space
Box: spaces
sql
time
Provides a custom Instant implementation, based on tarantool fiber API.
transaction
Transaction management
trigger
tuple
Tuples
util
uuid
vclock
Vector clock.

Macros§

c_ptr
Returns a *const std::ffi::c_char constructed from the provided literal with a nul byte appended to the end. Use this to pass static c-strings when working with ffi.
c_str
Returns a std::ffi::CStr constructed from the provided literal with a nul byte appended to the end. Use this when you need a &CStr from a string literal.
define_dlsym_reloc
define_enum_with_introspection
Auto-generate enum with some introspection facilities, including conversion from integers.
define_str_enum
Auto-generate enum that maps to a string.
expr_count
offset_of
Returns an offset of the struct or tuple member in bytes.
say_crit
say_debug
say_error
say_fatal
say_info
say_sys_error
say_verbose
say_warn
set_and_get_errorDeprecated
Set the last tarantool error and return it immediately.
set_error
Set the last error.
static_assert
tuple_from_box_api
unwrap_ok_or
unwrap_or
update
Update a tuple or index.
upsert
Upsert a tuple or index.

Functions§

lua_state
Create a new lua state with an isolated stack. The new state has access to all the global and tarantool data (Lua variables, tables, modules, etc.).

Type Aliases§

StdResult

Attribute Macros§

proc
#[tarantool::proc] is a macro attribute for creating stored procedure functions.