pub struct OwnedProllyTransaction<S>{ /* private fields */ }Expand description
A strict optimistic transaction that owns a cloned store handle.
This is useful for FFI bindings, where a transaction object needs to live
independently from a borrowed Rust stack frame. Normal Rust callers should
prefer Prolly::begin_transaction or Prolly::transaction.
Implementations§
Source§impl<S> OwnedProllyTransaction<S>
impl<S> OwnedProllyTransaction<S>
Sourcepub fn get(&self, tree: &Tree, key: &[u8]) -> Result<Option<Vec<u8>>, Error>
pub fn get(&self, tree: &Tree, key: &[u8]) -> Result<Option<Vec<u8>>, Error>
Get a value from a tree, including nodes staged in this transaction.
Sourcepub fn put(
&self,
tree: &Tree,
key: Vec<u8>,
value: Vec<u8>,
) -> Result<Tree, Error>
pub fn put( &self, tree: &Tree, key: Vec<u8>, value: Vec<u8>, ) -> Result<Tree, Error>
Insert or update a key/value pair, staging rewritten nodes.
Sourcepub fn delete(&self, tree: &Tree, key: &[u8]) -> Result<Tree, Error>
pub fn delete(&self, tree: &Tree, key: &[u8]) -> Result<Tree, Error>
Delete a key, staging rewritten nodes.
Sourcepub fn batch(
&self,
tree: &Tree,
mutations: Vec<Mutation>,
) -> Result<Tree, Error>
pub fn batch( &self, tree: &Tree, mutations: Vec<Mutation>, ) -> Result<Tree, Error>
Apply a batch of logical map mutations inside the transaction.
Sourcepub fn load_named_root(&self, name: &[u8]) -> Result<Option<Tree>, Error>
pub fn load_named_root(&self, name: &[u8]) -> Result<Option<Tree>, Error>
Load a named root and add it to the transaction read set.
Sourcepub fn publish_named_root(&self, name: &[u8], tree: &Tree) -> Result<(), Error>
pub fn publish_named_root(&self, name: &[u8], tree: &Tree) -> Result<(), Error>
Stage an unconditional named-root publish.
Sourcepub fn delete_named_root(&self, name: &[u8]) -> Result<(), Error>
pub fn delete_named_root(&self, name: &[u8]) -> Result<(), Error>
Stage an unconditional named-root delete.
Sourcepub fn compare_and_swap_named_root(
&self,
name: &[u8],
expected: Option<&Tree>,
new: Option<&Tree>,
) -> Result<NamedRootUpdate, Error>
pub fn compare_and_swap_named_root( &self, name: &[u8], expected: Option<&Tree>, new: Option<&Tree>, ) -> Result<NamedRootUpdate, Error>
Stage a named-root CAS update.
Sourcepub fn rollback(self)
pub fn rollback(self)
Discard all staged writes. Dropping an uncommitted transaction has the same effect; this method is useful when callers want to be explicit.
Sourcepub fn commit(self) -> Result<TransactionUpdate, Error>
pub fn commit(self) -> Result<TransactionUpdate, Error>
Commit staged node and named-root writes atomically.
Trait Implementations§
Source§impl<S> Drop for OwnedProllyTransaction<S>
impl<S> Drop for OwnedProllyTransaction<S>
Auto Trait Implementations§
impl<S> !Freeze for OwnedProllyTransaction<S>
impl<S> RefUnwindSafe for OwnedProllyTransaction<S>where
S: RefUnwindSafe,
impl<S> Send for OwnedProllyTransaction<S>
impl<S> Sync for OwnedProllyTransaction<S>
impl<S> Unpin for OwnedProllyTransaction<S>where
S: Unpin,
impl<S> UnsafeUnpin for OwnedProllyTransaction<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for OwnedProllyTransaction<S>where
S: UnwindSafe,
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
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>
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>
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 more