Struct fdb::transaction::FdbTransaction
source · pub struct FdbTransaction { /* private fields */ }
Expand description
A handle to a FDB transaction.
create_transaction
method on FdbDatabase
can be used to
create a FdbTransaction
.
Implementations§
source§impl FdbTransaction
impl FdbTransaction
sourcepub fn snapshot(&self) -> FdbReadTransaction
pub fn snapshot(&self) -> FdbReadTransaction
Return a special-purpose, read-only view of the database
(FdbReadTransaction
). Reads done using snapshot
are
known as snapshot reads. Snapshot reads selectively relax
FDB’s isolation property, reducing transaction conflicts but
making reasoning about concurrency harder.
For more information about how to use snapshot reads correctly, see snapshot reads.
sourcepub async unsafe fn run<T, F, Fut>(&self, f: F) -> FdbResult<T>where
F: FnMut(FdbTransaction) -> Fut,
Fut: Future<Output = FdbResult<T>>,
pub async unsafe 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 of this FdbTransaction
.
Safety
You should not use this API. It exists to support binding tester.
sourcepub async unsafe fn read<T, F, Fut>(&self, f: F) -> FdbResult<T>where
F: FnMut(FdbTransaction) -> Fut,
Fut: Future<Output = FdbResult<T>>,
pub async unsafe fn read<T, F, Fut>(&self, f: F) -> FdbResult<T>where F: FnMut(FdbTransaction) -> Fut, Fut: Future<Output = FdbResult<T>>,
Runs a closure in the context of FdbReadTransaction
,
derived from FdbTransaction
.
Safety
You should not use this API. It exists to support binding tester.
Trait Implementations§
source§impl Clone for FdbTransaction
impl Clone for FdbTransaction
source§fn clone(&self) -> FdbTransaction
fn clone(&self) -> FdbTransaction
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for FdbTransaction
impl Debug for FdbTransaction
source§impl Drop for FdbTransaction
impl Drop for FdbTransaction
source§impl ReadTransaction for FdbTransaction
impl ReadTransaction for FdbTransaction
source§unsafe fn on_error(&self, e: FdbError) -> FdbFutureUnit
unsafe fn on_error(&self, e: FdbError) -> FdbFutureUnit
Determines whether an error returned by a
Transaction
or ReadTransaction
method is retryable. Waiting on the returned future will
return the same error when fatal, or return ()
for retryable
errors. Read moresource§fn get(&self, key: impl Into<Key>) -> FdbFutureMaybeValue
fn get(&self, key: impl Into<Key>) -> FdbFutureMaybeValue
Gets a value from the database. Read more
source§fn get_addresses_for_key(&self, key: impl Into<Key>) -> FdbFutureCStringArray
fn get_addresses_for_key(&self, key: impl Into<Key>) -> FdbFutureCStringArray
source§fn get_estimated_range_size_bytes(&self, range: Range) -> FdbFutureI64
fn get_estimated_range_size_bytes(&self, range: Range) -> FdbFutureI64
Gets an estimate for the number of bytes stored in the given
range. Read more
source§fn get_key(&self, selector: KeySelector) -> FdbFutureKey
fn get_key(&self, selector: KeySelector) -> FdbFutureKey
Returns the key referenced by the specificed
KeySelector
. Read moresource§fn get_mapped_range(
&self,
begin: KeySelector,
end: KeySelector,
mapper: impl Into<Mapper>,
options: RangeOptions
) -> FdbStreamMappedKeyValue
fn get_mapped_range( &self, begin: KeySelector, end: KeySelector, mapper: impl Into<Mapper>, options: RangeOptions ) -> FdbStreamMappedKeyValue
WARNING: This feature is considered experimental at this time. Read more
source§fn get_range(
&self,
begin: KeySelector,
end: KeySelector,
options: RangeOptions
) -> FdbStreamKeyValue
fn get_range( &self, begin: KeySelector, end: KeySelector, options: RangeOptions ) -> FdbStreamKeyValue
Gets an ordered range of keys and values from the database. Read more
source§fn get_range_split_points(
&self,
begin: impl Into<Key>,
end: impl Into<Key>,
chunk_size: i64
) -> FdbFutureKeyArray
fn get_range_split_points( &self, begin: impl Into<Key>, end: impl Into<Key>, chunk_size: i64 ) -> FdbFutureKeyArray
Gets a list of keys that can split the given range into
(roughly) equally sized chunks based on
chunk_size
. Read moresource§unsafe fn get_read_version(&self) -> FdbFutureI64
unsafe fn get_read_version(&self) -> FdbFutureI64
Gets the version at which the reads for this
Transaction
or ReadTransaction
will access the database. Read moresource§unsafe fn set_option(&self, option: TransactionOption) -> FdbResult<()>
unsafe fn set_option(&self, option: TransactionOption) -> FdbResult<()>
source§unsafe fn set_read_version(&self, version: i64)
unsafe fn set_read_version(&self, version: i64)
Directly sets the version of the database at which to execute
reads. Read more
source§impl Transaction for FdbTransaction
impl Transaction for FdbTransaction
source§fn add_read_conflict_key(&self, key: impl Into<Key>) -> FdbResult<()>
fn add_read_conflict_key(&self, key: impl Into<Key>) -> FdbResult<()>
Adds a key to the transaction’s read conflict ranges as if you
had read the key.
source§fn add_read_conflict_range(&self, range: Range) -> FdbResult<()>
fn add_read_conflict_range(&self, range: Range) -> FdbResult<()>
Adds a range of keys to the transaction’s read conflict ranges
as if you had read the range.
source§fn add_write_conflict_key(&self, key: impl Into<Key>) -> FdbResult<()>
fn add_write_conflict_key(&self, key: impl Into<Key>) -> FdbResult<()>
Adds a key to the transaction’s write conflict ranges as if
you had written the key.
source§fn add_write_conflict_range(&self, range: Range) -> FdbResult<()>
fn add_write_conflict_range(&self, range: Range) -> FdbResult<()>
Adds a range of keys to the transaction’s write conflict
ranges as if you had cleared the range.
source§unsafe fn cancel(&self)
unsafe fn cancel(&self)
Cancels the
Transaction
. Read moresource§fn clear_range(&self, range: Range)
fn clear_range(&self, range: Range)
Clears a range of keys from the database.
source§unsafe fn commit(&self) -> FdbFutureUnit
unsafe fn commit(&self) -> FdbFutureUnit
Commit this
Transaction
. Read moresource§fn get_approximate_size(&self) -> FdbFutureI64
fn get_approximate_size(&self) -> FdbFutureI64
Returns a future that will contain the approximated size of
the commit, which is the summation of mutations, read conflict
ranges, and write conflict ranges. Read more
source§unsafe fn get_committed_version(&self) -> CommittedVersion
unsafe fn get_committed_version(&self) -> CommittedVersion
Gets the version number at which a successful commit modified
the database. Read more
source§unsafe fn get_versionstamp(&self) -> TransactionVersionstamp
unsafe fn get_versionstamp(&self) -> TransactionVersionstamp
Returns
TransactionVersionstamp
from which you can get the
versionstamp which was used by any versionstamp operations in
this transaction. Read moresource§unsafe fn mutate(&self, optype: MutationType, key: impl Into<Key>, param: Bytes)
unsafe fn mutate(&self, optype: MutationType, key: impl Into<Key>, param: Bytes)
An atomic operation is a single database command that carries
out several logical steps: reading the value of a key,
performing a transformation on that value, and writing the
result. Read more
source§unsafe fn reset(&self)
unsafe fn reset(&self)
Reset the
Transaction
. Read moreimpl Send for FdbTransaction
impl Sync for FdbTransaction
Auto Trait Implementations§
impl RefUnwindSafe for FdbTransaction
impl Unpin for FdbTransaction
impl UnwindSafe for FdbTransaction
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