Function foundationdb::init
source · Expand description
Initialize the FoundationDB Client API, this can only be called once per process.
Returns
Network
which must be run before the Client is ready. Network::run
will not return until the
network is stopped with the associated Network::stop
and should be run in a separate thread.
Examples
use std::thread;
use foundationdb;
let network = foundationdb::init().expect("failed to initialize Fdb");
let handle = std::thread::spawn(move || {
let error = network.run();
if let Err(error) = error {
panic!("fdb_run_network: {}", error);
}
});
network.wait();
// do some interesting things with the API...
network.stop().expect("failed to stop network");
handle.join().expect("failed to join fdb thread");