[][src]Struct foundationdb::Database

pub struct Database { /* fields omitted */ }

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]

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]

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]

Trait Implementations

impl Drop for Database[src]

impl Send for Database[src]

impl Sync for Database[src]

Auto Trait Implementations

impl RefUnwindSafe for Database

impl Unpin for Database

impl UnwindSafe for Database

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,