3 releases

0.1.2 Sep 21, 2021
0.1.1 Jul 19, 2020
0.1.0 Jul 19, 2020

#2601 in Database interfaces


Used in extremedb

MIT license

68KB
1.5K SLoC

extremedb_sys

Low-level FFI bindings to McObject eXtremeDB for Rust.

This package contains the low-level, unsafe Rust declarations of the eXtremeDB C API functions, as well as structures and enumerations matching their C counterparts. Most applications will never call the functions declared in this package directly.

A few environment variables must be set prior to building this package. For details, refer to the documentation.

Note that an existing installation of eXtremeDB 8.2 is required to build this package. An evaluation eXtremeDB package can be requested at the McObject website.


lib.rs:

extremedb_sys is a low-level FFI wrapper for the McObject's eXtremeDB database management system libraries.

This crate contains Rust declarations of the eXtremeDB API functions and a Cargo build script which locates and links the appropriate eXtremeDB libraries.

The exact set of the linked eXtremeDB libraries depends on the configuration. See the discussion below for details.

Configuration

Native eXtremeDB applications have to link with a number of eXtremeDB libraries. Both static and dynamic linking is possible. Some of these libraries are interchangeable, and the applications choose the appropriate ones depending on their requirements. For example, the applications can choose one of the supported transaction managers: Exclusive, MURSIW, or MVCC. There are other features which require linking specific libraries. Refer to the eXtremeDB reference manual for more details.

This approach is beneficial for the performance of the applications, since they can avoid linking libraries they do not need. Furthermore, there is no dynamic dispatch required: if the application links with the MURSIW transaction manager library, then its functions are called directly.

However, this approach is not quite compatible with the Rust's typical build process. Most packages choose to use Cargo features to enable optional functionality. The features are designed to be additive, and cannot be mutually exclusive. Because of this, extremedb_sys uses environment variables for configuration.

Environment Variables

extremedb_sys requires all of the following variables to be set. Since the selection of the appropriate features is critical for the correct functioning of the applications, these variables have no default values. If any of them is missing, the build process is aborted.

  • MCO_ROOT: path to the eXtremeDB root directory.
  • MCORS_CFG_DYLIB: defines how the eXtremeDB libraries are to be linked:
    • 0: statically;
    • 1: dynamically.
  • MCORS_CFG_DPTR: selects the eXtremeDB implementation libraries:
    • 0: offset libraries;
    • 1: direct pointer libraries.
  • MCORS_CFG_DISK: configures database persistence:
    • 0: in-memory database;
    • 1: disk or mixed mode database.
  • MCORS_CFG_SHMEM: configures shared memory support:
    • 0: conventional memory;
    • 1: shared memory.
  • MCORS_CFG_TMGR: selects the transaction manager library:
    • excl (exclusive);
    • mursiw;
    • mvcc.

Features

Non-mutually-exclusive options can be enabled using the Cargo features.

The following features are supported. Applications are not expected to set them explicitly; they are configured by the extremedb crate.

  • sequences — Sequences (vertical storage).
  • sql — SQL engine (local and remote).

No runtime deps

~160KB