fuel_core_storage

Trait 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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>>,