Struct ethcore_db::DBTransaction
source · [−]Expand description
Write transaction. Batches a sequence of put/delete operations for efficiency.
Fields
ops: Vec<DBOp, Global>
Database operations.
Implementations
sourceimpl DBTransaction
impl DBTransaction
sourcepub fn new() -> DBTransaction
pub fn new() -> DBTransaction
Create new transaction.
sourcepub fn with_capacity(cap: usize) -> DBTransaction
pub fn with_capacity(cap: usize) -> DBTransaction
Create new transaction with capacity.
sourcepub fn put(&mut self, col: Option<u32>, key: &[u8], value: &[u8])
pub fn put(&mut self, col: Option<u32>, key: &[u8], value: &[u8])
Insert a key-value pair in the transaction. Any existing value will be overwritten upon write.
Trait Implementations
sourceimpl Clone for DBTransaction
impl Clone for DBTransaction
sourcepub fn clone(&self) -> DBTransaction
pub fn clone(&self) -> DBTransaction
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 Default for DBTransaction
impl Default for DBTransaction
sourcepub fn default() -> DBTransaction
pub fn default() -> DBTransaction
Returns the “default value” for a type. Read more
sourceimpl PartialEq<DBTransaction> for DBTransaction
impl PartialEq<DBTransaction> for DBTransaction
sourcepub fn eq(&self, other: &DBTransaction) -> bool
pub fn eq(&self, other: &DBTransaction) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcepub fn ne(&self, other: &DBTransaction) -> bool
pub fn ne(&self, other: &DBTransaction) -> bool
This method tests for !=
.
sourceimpl Writable for DBTransaction
impl Writable for DBTransaction
sourcefn write<T, R>(
&mut self,
col: Option<u32>,
key: &dyn Key<T, Target = R>,
value: &T
) where
T: Encodable,
R: AsRef<[u8]>,
fn write<T, R>(
&mut self,
col: Option<u32>,
key: &dyn Key<T, Target = R>,
value: &T
) where
T: Encodable,
R: AsRef<[u8]>,
Writes the value into the database.
sourcefn delete<T, R>(&mut self, col: Option<u32>, key: &dyn Key<T, Target = R>) where
T: Encodable,
R: AsRef<[u8]>,
fn delete<T, R>(&mut self, col: Option<u32>, key: &dyn Key<T, Target = R>) where
T: Encodable,
R: AsRef<[u8]>,
Deletes key from the databse.
sourcefn write_with_cache<K, T, R>(
&mut self,
col: Option<u32>,
cache: &mut dyn Cache<K, T>,
key: K,
value: T,
policy: CacheUpdatePolicy
) where
K: Key<T, Target = R> + Hash + Eq,
T: Encodable,
R: AsRef<[u8]>,
fn write_with_cache<K, T, R>(
&mut self,
col: Option<u32>,
cache: &mut dyn Cache<K, T>,
key: K,
value: T,
policy: CacheUpdatePolicy
) where
K: Key<T, Target = R> + Hash + Eq,
T: Encodable,
R: AsRef<[u8]>,
Writes the value into the database and updates the cache.
sourcefn extend_with_cache<K, T, R>(
&mut self,
col: Option<u32>,
cache: &mut dyn Cache<K, T>,
values: HashMap<K, T>,
policy: CacheUpdatePolicy
) where
K: Key<T, Target = R> + Hash + Eq,
T: Encodable,
R: AsRef<[u8]>,
fn extend_with_cache<K, T, R>(
&mut self,
col: Option<u32>,
cache: &mut dyn Cache<K, T>,
values: HashMap<K, T>,
policy: CacheUpdatePolicy
) where
K: Key<T, Target = R> + Hash + Eq,
T: Encodable,
R: AsRef<[u8]>,
Writes the values into the database and updates the cache.
sourcefn extend_with_option_cache<K, T, R>(
&mut self,
col: Option<u32>,
cache: &mut dyn Cache<K, Option<T>>,
values: HashMap<K, Option<T>>,
policy: CacheUpdatePolicy
) where
K: Key<T, Target = R> + Hash + Eq,
T: Encodable,
R: AsRef<[u8]>,
fn extend_with_option_cache<K, T, R>(
&mut self,
col: Option<u32>,
cache: &mut dyn Cache<K, Option<T>>,
values: HashMap<K, Option<T>>,
policy: CacheUpdatePolicy
) where
K: Key<T, Target = R> + Hash + Eq,
T: Encodable,
R: AsRef<[u8]>,
Writes and removes the values into the database and updates the cache.
impl StructuralPartialEq for DBTransaction
Auto Trait Implementations
impl RefUnwindSafe for DBTransaction
impl Send for DBTransaction
impl Sync for DBTransaction
impl Unpin for DBTransaction
impl UnwindSafe for DBTransaction
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