pub struct FdbTenant { /* private fields */ }Expand description
FdbTenant provides APIs for transactionally interacting with
Tenants.
The simplest correct programs using tentants will make use of the
run and read methods. run will call commit after
the user code has been executed.
A handle to FDB tentant. All reads and writes to the tenant are transactional.
A FdbTenant can be created using open_tenant method.
Implementations§
source§impl FdbTenant
impl FdbTenant
sourcepub fn create_transaction(&self) -> FdbResult<FdbTransaction>
pub fn create_transaction(&self) -> FdbResult<FdbTransaction>
Creates a FdbTransaction that operates on this
FdbTenant.
sourcepub async fn run<T, F, Fut>(&self, f: F) -> FdbResult<T>where
F: FnMut(FdbTransaction) -> Fut,
Fut: Future<Output = FdbResult<T>>,
pub async fn run<T, F, Fut>(&self, f: F) -> FdbResult<T>where F: FnMut(FdbTransaction) -> Fut, Fut: Future<Output = FdbResult<T>>,
Runs a closure in the context that takes a FdbTransaction.
Note
The closure FnMut: FnMut(FdbTransaction) -> Fut will run
multiple times (retry) when certain errors are
encountered. Therefore the closure should be prepared to be
called more than once. This consideration means that the
closure should use caution when modifying state.
sourcepub async fn read<T, F, Fut>(&self, f: F) -> FdbResult<T>where
F: FnMut(FdbReadTransaction) -> Fut,
Fut: Future<Output = FdbResult<T>>,
pub async fn read<T, F, Fut>(&self, f: F) -> FdbResult<T>where F: FnMut(FdbReadTransaction) -> Fut, Fut: Future<Output = FdbResult<T>>,
Runs a closure in the context that takes a
FdbReadTransaction.
Note
The closure F: FnMut(FdbReadTransaction) -> Fut will run
multiple times (retry) when certain errors are
encountered. Therefore the closure should be prepared to be
called more than once. This consideration means that the
closure should use caution when modifying state.