pub trait StorageBatchMutate<Type: Mappable>: StorageMutate<Type> {
// Required methods
fn init_storage<'a, Iter>(&mut self, set: Iter) -> Result<()>
where Iter: 'a + Iterator<Item = (&'a Type::Key, &'a Type::Value)>,
Type::Key: 'a,
Type::Value: 'a;
fn insert_batch<'a, Iter>(&mut self, set: Iter) -> Result<()>
where Iter: 'a + Iterator<Item = (&'a Type::Key, &'a Type::Value)>,
Type::Key: 'a,
Type::Value: 'a;
fn remove_batch<'a, Iter>(&mut self, set: Iter) -> Result<()>
where Iter: 'a + Iterator<Item = &'a Type::Key>,
Type::Key: 'a;
}
Expand description
The traits allow work with the storage in batches. Some implementations can perform batch operations faster than one by one.
Required Methods§
sourcefn init_storage<'a, Iter>(&mut self, set: Iter) -> Result<()>
fn init_storage<'a, Iter>(&mut self, set: Iter) -> Result<()>
Initialize the storage with batch insertion. This method is more performant than
Self::insert_batch
in some cases.
§Errors
Returns an error if the storage is already initialized.
sourcefn insert_batch<'a, Iter>(&mut self, set: Iter) -> Result<()>
fn insert_batch<'a, Iter>(&mut self, set: Iter) -> Result<()>
Inserts the key-value pair into the storage in batch.
Object Safety§
This trait is not object safe.