Struct sp_database::Transaction
source · [−]Expand description
A series of changes to the database that can be committed atomically. They do not take effect
until passed into Database::commit
.
Tuple Fields
0: Vec<Change<H>>
Implementations
sourceimpl<H> Transaction<H>
impl<H> Transaction<H>
sourcepub fn set(&mut self, col: ColumnId, key: &[u8], value: &[u8])
pub fn set(&mut self, col: ColumnId, key: &[u8], value: &[u8])
Set the value of key
in col
to value
, replacing anything that is there currently.
sourcepub fn set_from_vec(&mut self, col: ColumnId, key: &[u8], value: Vec<u8>)
pub fn set_from_vec(&mut self, col: ColumnId, key: &[u8], value: Vec<u8>)
Set the value of key
in col
to value
, replacing anything that is there currently.
sourcepub fn store(&mut self, hash: H, preimage: &[u8])
pub fn store(&mut self, hash: H, preimage: &[u8])
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
.
Trait Implementations
sourceimpl<H: Clone> Clone for Transaction<H>
impl<H: Clone> Clone for Transaction<H>
sourcefn clone(&self) -> Transaction<H>
fn clone(&self) -> Transaction<H>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<H: Default> Default for Transaction<H>
impl<H: Default> Default for Transaction<H>
sourcefn default() -> Transaction<H>
fn default() -> Transaction<H>
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl<H> RefUnwindSafe for Transaction<H> where
H: RefUnwindSafe,
impl<H> Send for Transaction<H> where
H: Send,
impl<H> Sync for Transaction<H> where
H: Sync,
impl<H> Unpin for Transaction<H> where
H: Unpin,
impl<H> UnwindSafe for Transaction<H> where
H: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more