pub struct NetworkBuilder { /* private fields */ }Expand description
A Builder to configure network options and start the network event loop.
use foundationdb::api::FdbApiBuilder;
let network_builder = FdbApiBuilder::default().build().expect("fdb api initialized");
network_builder.boot().expect("fdb network running");Implementations§
Source§impl NetworkBuilder
impl NetworkBuilder
Sourcepub fn set_option(self, option: NetworkOption) -> FdbResult<Self>
pub fn set_option(self, option: NetworkOption) -> FdbResult<Self>
Set network options.
§Errors
- error 2009 (
network_already_setup) once the network is running - error 2025 (
network_cannot_be_restarted) once the network is stopped
Sourcepub fn boot(self) -> FdbResult<NetworkAutoStop>
pub fn boot(self) -> FdbResult<NetworkAutoStop>
Starts the FoundationDB network event loop in a dedicated thread.
Safe and idempotent: booting an already running network is a no-op. The
network runs until process exit, where an atexit hook stops it and joins the
network thread, or until an explicit stop_network call.
§Errors
- error 2025 (
network_cannot_be_restarted) if the network was stopped
§Examples
use foundationdb::api::FdbApiBuilder;
let network_builder = FdbApiBuilder::default().build().expect("fdb api initialized");
network_builder.boot().expect("fdb network running");
// do some interesting things with the API...use foundationdb::api::FdbApiBuilder;
#[tokio::main]
async fn main() {
let network_builder = FdbApiBuilder::default().build().expect("fdb api initialized");
network_builder.boot().expect("fdb network running");
// do some interesting things with the API...
}Auto Trait Implementations§
impl Freeze for NetworkBuilder
impl RefUnwindSafe for NetworkBuilder
impl Send for NetworkBuilder
impl Sync for NetworkBuilder
impl Unpin for NetworkBuilder
impl UnwindSafe for NetworkBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more