Trait fuel_core_storage::StorageBatchMutate

source ·
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§

source

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,

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.

source

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,

Inserts the key-value pair into the storage in batch.

source

fn remove_batch<'a, Iter>(&mut self, set: Iter) -> Result<()>
where Iter: 'a + Iterator<Item = &'a Type::Key>, Type::Key: 'a,

Removes the key-value pairs from the storage in batch.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T: StorageBatchMutate<Type>, Type: Mappable> StorageBatchMutate<Type> for &mut T

source§

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,

source§

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,

source§

fn remove_batch<'a, Iter>(&mut self, set: Iter) -> Result<()>
where Iter: 'a + Iterator<Item = &'a Type::Key>, Type::Key: 'a,

Implementors§

source§

impl<Column, S, M> StorageBatchMutate<M> for StructuredStorage<S>
where S: BatchOperations<Column = Column>, M: TableWithBlueprint<Column = Column>, M::Blueprint: SupportsBatching<M, StructuredStorage<S>>,