[−][src]Struct foundationdb::Database
Represents a FoundationDB database
A mutable, lexicographically ordered mapping from binary keys to binary values.
Modifications to a database are performed via transactions.
Implementations
impl Database
[src]
pub fn new(path: Option<&str>) -> FdbResult<Database>
[src]
Create a database for the given configuration path if any, or the default one.
pub fn from_path(path: &str) -> FdbResult<Database>
[src]
Create a database for the given configuration path
pub fn default() -> FdbResult<Database>
[src]
Create a database for the default configuration path
impl Database
[src]
pub async fn new_compat<'_>(path: Option<&'_ str>) -> FdbResult<Database>
[src]
Create a database for the given configuration path
This is a compatibility api. If you only use API version ≥ 610 you should
use Database::new
, Database::from_path
or Database::default
.
pub fn set_option(&self, opt: DatabaseOption) -> FdbResult<()>
[src]
Called to set an option an on Database
.
pub fn create_trx(&self) -> FdbResult<Transaction>
[src]
Creates a new transaction on the given database.
pub async fn transact<F, '_>(
&'_ self,
__arg1: F,
options: TransactOption
) -> Result<F::Item, F::Error> where
F: DatabaseTransact,
[src]
&'_ self,
__arg1: F,
options: TransactOption
) -> Result<F::Item, F::Error> where
F: DatabaseTransact,
transact
returns a future which retries on error. It tries to resolve a future created by
caller-provided function f
inside a retry loop, providing it with a newly created
transaction. After caller-provided future resolves, the transaction will be committed
automatically.
Warning
It might retry indefinitely if the transaction is highly contentious. It is recommended to
set TransactionOption::RetryLimit
or TransactionOption::SetTimeout
on the transaction
if the task need to be guaranteed to finish.
Once Generic Associated Types lands in stable rust, the returned future of f won't need to be boxed anymore, also the lifetime limitations around f might be lowered.
pub fn transact_boxed<'trx, F, D, T, E>(
&'trx self,
data: D,
f: F,
options: TransactOption
) -> impl Future<Output = Result<T, E>> + Send + 'trx where
F: FnMut(&'a Transaction, &'a mut D) -> Pin<Box<dyn Future<Output = Result<T, E>> + Send + 'a>>,
E: TransactError,
F: Send + 'trx,
T: Send + 'trx,
E: Send + 'trx,
D: Send + 'trx,
[src]
&'trx self,
data: D,
f: F,
options: TransactOption
) -> impl Future<Output = Result<T, E>> + Send + 'trx where
F: FnMut(&'a Transaction, &'a mut D) -> Pin<Box<dyn Future<Output = Result<T, E>> + Send + 'a>>,
E: TransactError,
F: Send + 'trx,
T: Send + 'trx,
E: Send + 'trx,
D: Send + 'trx,
pub fn transact_boxed_local<'trx, F, D, T, E>(
&'trx self,
data: D,
f: F,
options: TransactOption
) -> impl Future<Output = Result<T, E>> + 'trx where
F: FnMut(&'a Transaction, &'a mut D) -> Pin<Box<dyn Future<Output = Result<T, E>> + 'a>>,
E: TransactError,
F: 'trx,
T: 'trx,
E: 'trx,
D: 'trx,
[src]
&'trx self,
data: D,
f: F,
options: TransactOption
) -> impl Future<Output = Result<T, E>> + 'trx where
F: FnMut(&'a Transaction, &'a mut D) -> Pin<Box<dyn Future<Output = Result<T, E>> + 'a>>,
E: TransactError,
F: 'trx,
T: 'trx,
E: 'trx,
D: 'trx,
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,