[][src]Crate yottadb

YottaDB is a NoSQL Database suitable for high-performance systems.

YottaDB runs in-process, like SQLite, with no need for a daemon. This crate is a Rust wrapper around the C implementation of YottaDB.

There are three major APIs:

The context_api is recommended for normal use, but the others are available if your needs are more specialized.

Features

Since yottadb is a set of bindings to a C library, it uses bindgen to generate the bindings. There are two ways to do this:

Using vendoring means you can use yottadb in any user environment, even when you don't have admin priviledges to install programs. Using a pre-installed version means compile times are much lower.

Signal handling

YottaDB performs its own signal handling in addition to any signal handlers you may have set up. Since many functions in C are not async-safe, it defers any action until the next time ydb_eintr_handler is called. All YDB functions will automatically call ydb_eintr_handler if necessary, so in most cases this should not affect your application. However, there are some rare cases when the handler will not be called:

For example, the following loop will run forever even if sent SIGINT:

use yottadb::context_api::{Context, KeyContext};
let ctx = Context::new();
let loop_callback = |_| loop {
    std::thread::sleep(std::time::Duration::from_secs(1));
    println!("finished sleep");
};
ctx.tp(loop_callback, "BATCH", &[]).unwrap();

To avoid this, call eintr_handler in the loop:

loop {
    std::thread::sleep(std::time::Duration::from_secs(1));
    ctx.eintr_handler()?;
    println!("finished sleep");
}

However, you should endeavor to keep transactions as short as possible - both for performance, since YottaDB uses optimistic concurrency control, and for reliability, since operations will not be committed until the transaction concludes.

As a last-ditch method of error-recovery, YottaDB will exit immediately if sent three interrupt signals in a row, even if eintr_handler is not called.

YottaDB does not register any signal handlers until the first time ydb_init is called, and deregisters its handlers after ydb_exit.

See also

Re-exports

pub use craw::YDB_ERR_GVUNDEF;
pub use craw::YDB_ERR_LVUNDEF;
pub use simple_api::call_in::CallInDescriptor;
pub use simple_api::call_in::CallInTableDescriptor;
pub use simple_api::DataReturn;
pub use simple_api::DeleteType;
pub use simple_api::TransactionStatus;
pub use simple_api::TpToken;
pub use simple_api::YDBError;
pub use simple_api::YDBResult;

Modules

context_api

Provides a Rust-interface for YottaDB which hides some of the complexity related to managing error-return buffers and tptokens.

craw

A wrapper for C YottaDB API (the C Raw API, CRAW)

simple_api

Provides a more-friendly Rust-interface to the YottaDB API than the raw C API (craw).

Macros

ci_t

Make an FFI call to M.

cip_t

Make a FFI call to M using a cached function descriptor.

make_ckey

Create a KeyContext with the given subscripts, provided a context.

make_key

Provides a Key object for the given subscripts.

Constants

YDB_NOTTP

The default transaction processing token if no transaction is in progress.

Functions

ydb_exit

Cleans up the process connection/access to all databases and all yottadb data structures.