Struct sp_database::Transaction [−][src]
A series of changes to the database that can be committed atomically. They do not take effect
until passed into Database::commit
.
Implementations
impl<H> Transaction<H>
[src]
pub fn new() -> Self
[src]
Create a new transaction to be prepared and committed atomically.
pub fn set(&mut self, col: ColumnId, key: &[u8], value: &[u8])
[src]
Set the value of key
in col
to value
, replacing anything that is there currently.
pub fn set_from_vec(&mut self, col: ColumnId, key: &[u8], value: Vec<u8>)
[src]
Set the value of key
in col
to value
, replacing anything that is there currently.
pub fn remove(&mut self, col: ColumnId, key: &[u8])
[src]
Remove the value of key
in col
.
pub fn store(&mut self, hash: H, preimage: &[u8])
[src]
Store the preimage
of hash
into the database, so that it may be looked up later with
Database::lookup
. This may be called multiple times, but Database::lookup
but subsequent
calls will ignore preimage
and simply increase the number of references on hash
.
pub fn release(&mut self, hash: H)
[src]
Release the preimage of hash
from the database. An equal number of these to the number of
corresponding store
s must have been given before it is legal for Database::lookup
to
be unable to provide the preimage.
Trait Implementations
impl<H: Clone> Clone for Transaction<H>
[src]
fn clone(&self) -> Transaction<H>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<H: Default> Default for Transaction<H>
[src]
fn default() -> Transaction<H>
[src]
Auto Trait Implementations
impl<H> RefUnwindSafe for Transaction<H> where
H: RefUnwindSafe,
[src]
H: RefUnwindSafe,
impl<H> Send for Transaction<H> where
H: Send,
[src]
H: Send,
impl<H> Sync for Transaction<H> where
H: Sync,
[src]
H: Sync,
impl<H> Unpin for Transaction<H> where
H: Unpin,
[src]
H: Unpin,
impl<H> UnwindSafe for Transaction<H> where
H: UnwindSafe,
[src]
H: UnwindSafe,
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,
pub 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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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.
pub 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>,