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.
  • Functions and constants documenting the organization of the reserved keyspace in the database beginning with \xFF.
  • 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

Enums

Constants

Functions