Struct sp_database::Transaction
source · pub struct Transaction<H>(pub Vec<Change<H>>);
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§
source§impl<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, col: ColumnId, hash: H, preimage: Vec<u8>)
pub fn store(&mut self, col: ColumnId, hash: H, preimage: Vec<u8>)
Store the preimage
of hash
into the database, so that it may be looked up later with
Database::get
. This may be called multiple times, but subsequent
calls will ignore preimage
and simply increase the number of references on hash
.
Trait Implementations§
source§impl<H: Clone> Clone for Transaction<H>
impl<H: Clone> Clone for Transaction<H>
source§fn clone(&self) -> Transaction<H>
fn clone(&self) -> Transaction<H>
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<H: Default> Default for Transaction<H>
impl<H: Default> Default for Transaction<H>
source§fn default() -> Transaction<H>
fn default() -> Transaction<H>
Returns the “default value” for a type. Read more