Module api

Source
Expand description

Configuration of foundationDB API and Network

Provides a safe wrapper around the following C API calls:

The network lifecycle is tracked by a process-global state machine (Uninitialized -> ApiVersionSelected -> Running -> Stopped). Booting is safe and idempotent, the network is started lazily by crate::Database constructors if needed, and it runs until process exit: an atexit hook stops it and joins the network thread, as required by the C API. Applications that manage their own shutdown can call disable_stop_on_exit and/or stop_network.

The automatic stop at process exit is meant for tests and short-lived tools. In a production application, prefer a clean teardown: the network thread is the event loop driving every transaction and you may still have on-going operations at exit time. Finish or cancel your work, drop the crate::Database handles, then call stop_network yourself.

Structs§

FdbApiBuilder
A Builder with which different versions of the Fdb C API can be initialized
NetworkAutoStop
Kept for backward compatibility: dropping it does nothing.
NetworkBuilder
A Builder to configure network options and start the network event loop.

Functions§

disable_stop_on_exit
Disables the automatic network stop at process exit.
get_max_api_version
Returns the max api version of the underlying Fdb C API Client
network_run_error
Returns the error reported by the network event loop, if it stopped with one.
stop_network
Stops the FoundationDB network and joins the network thread.