Crate fdb

source · []
Expand description

FoundationDB Client API for Tokio

Guide level documentation is on our website. You will find API level documentation here.

A minimal example to get started.

use tokio::runtime::Runtime;

use std::env;
use std::error::Error

fn main() -> Result<(), Box<dyn Error>> {
    let fdb_cluster_file = env::var("FDB_CLUSTER_FILE").expect("FDB_CLUSTER_FILE not defined!");

    unsafe {
        fdb::select_api_version(710);
        fdb::start_network();
    }

    let fdb_database = fdb::open_database(fdb_cluster_file)?;

    let rt = Runtime::new()?;

    let cloned_fdb_database = fdb_database.clone();

    rt.block_on(async {
        let fdb_database = cloned_fdb_database;

        // your main async app here

        Result::<(), Box<dyn Error>>::Ok(())
    })?;

    drop(fdb_database);

    unsafe {
        fdb::stop_network();
    }

    Ok(())
}

Modules

Provides FdbDatabase type for working with FDB Database.

Provides FdbError type, FdbResult type alias and error constants.

Provides FdbFuture, FdbStreamKeyValue types and FdbFutureGet trait for working with FDB Future.

Provides types for working with FDB range.

Provides a convenient way to define namespaces for different categories of data.

Provides FdbTenant type for working with FDB Tenants.

Provides types and traits for working with FDB Transactions and Snapshots.

Provides a set of utilities for serializing and deserializing typed data for use in FDB.

Structs

Key represents a FDB key, a lexicographically-ordered sequence of bytes.

KeySelector identifies a particular key in the database.

A key/value pair.

A mapped key/value pair.

Mapper represents the behaviour of a mapped range read.

Tenant is a named key-space within a database.

Value represents a value of an FDB Key and is a sequence of bytes.

Enums

A set of options that can be set globally for the FDB API.

Constants

Maximum API version supported by the client

Functions

Returns FdbDatabase handle to the FDB cluster identified by the provided cluster file.

Select the version of the client API.

Set global options for the FDB API.

Initializes FDB network.

Stops the FDB networking engine.