pub struct Transaction<'a> { /* private fields */ }Expand description
Write-through transactional context for ACID operations
Implementations§
Source§impl Transaction<'_>
impl Transaction<'_>
Sourcepub fn set(&mut self, key: &[u8], value: Vec<u8>) -> Result<()>
pub fn set(&mut self, key: &[u8], value: Vec<u8>) -> Result<()>
Sets a key-value pair directly in the engine with undo logging
Sourcepub fn delete(&mut self, key: &[u8]) -> Result<()>
pub fn delete(&mut self, key: &[u8]) -> Result<()>
Deletes a key directly in the engine with undo logging
Sourcepub fn get(&self, key: &[u8]) -> Option<Rc<[u8]>>
pub fn get(&self, key: &[u8]) -> Option<Rc<[u8]>>
Retrieves a value directly from the engine (no transaction-local state)
Sourcepub fn scan(
&self,
range: Range<Vec<u8>>,
) -> Result<Box<dyn Iterator<Item = (Vec<u8>, Rc<[u8]>)> + '_>>
pub fn scan( &self, range: Range<Vec<u8>>, ) -> Result<Box<dyn Iterator<Item = (Vec<u8>, Rc<[u8]>)> + '_>>
Scans a range directly from the engine (no transaction-local state)
Sourcepub fn has_pending_operations(&self) -> bool
pub fn has_pending_operations(&self) -> bool
Returns true if the transaction has pending operations (i.e., uncommitted changes)
Sourcepub fn is_clean(&self) -> bool
pub fn is_clean(&self) -> bool
Returns true if the transaction is clean (no pending operations)
Sourcepub fn is_finalized(&self) -> bool
pub fn is_finalized(&self) -> bool
Returns true if the transaction has been finalized (committed or rolled back)
Trait Implementations§
Source§impl Drop for Transaction<'_>
impl Drop for Transaction<'_>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Transaction<'a>
impl<'a> !Send for Transaction<'a>
impl<'a> !Sync for Transaction<'a>
impl<'a> !UnwindSafe for Transaction<'a>
impl<'a> Freeze for Transaction<'a>
impl<'a> Unpin for Transaction<'a>
impl<'a> UnsafeUnpin for Transaction<'a>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.