Expand description
Tarantool C API bindings for Rust. This library contains the following Tarantool API’s:
- Box: spaces, indexes, sequences
- Fibers: fiber attributes, conditional variables, latches, async runtime
- CoIO
- Transactions
- Schema management
- Protocol implementation (
net.box
): CRUD, stored procedure call, triggers - Alternative async protocol implementation (
network::client
): Async, coio based CRUD - Tuple utils
- Decimal numbers
- Logging (see https://docs.rs/log/)
- Error handling
- Stored procedures
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:
examples/easy
- prints “hello world”;examples/harder
- decodes a passed parameter value;examples/hardest
- uses this library to do a DBMS insert;examples/read
- uses this library to do a DBMS select;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§
Modules§
- The
clock
module returns time values derived from the Posix / C CLOCK_GETTIME function or equivalent. - Cooperative input/output
- Error handling utils.
- Сooperative multitasking module with optional async runtime.
- Box: indices
- Logging utils. See “log” crate documentation for details
- The
net_box
module contains connector to remote Tarantool server instances via a network. - Sans-I/O network client for connecting to remote Tarantool server.
- Box: sequences
- Box: session
- Box: spaces
- Provides a custom
Instant
implementation, based on tarantool fiber API. - Transaction management
- Tuples
- Vector clock.
Macros§
- 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. - 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. - Auto-generate enum with some introspection facilities, including conversion from integers.
- Auto-generate enum that maps to a string.
- Returns an offset of the struct or tuple member in bytes.
- set_
and_ get_ error Deprecated Set the last tarantool error and return it immediately. - Set the last error.
- Update a tuple or index.
- Upsert a tuple or index.
Functions§
- 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§
Attribute Macros§
#[tarantool::proc]
is a macro attribute for creating stored procedure functions.