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§
- 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_ error Deprecated - 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§
Attribute Macros§
- proc
#[tarantool::proc]
is a macro attribute for creating stored procedure functions.