Trait fuel_core_storage::blueprint::SupportsBatching

source ·
pub trait SupportsBatching<M, S>: BlueprintMutate<M, S>{
    // Required methods
    fn init<'a, Iter>(
        storage: &mut S,
        column: S::Column,
        set: Iter,
    ) -> StorageResult<()>
       where Iter: 'a + Iterator<Item = (&'a M::Key, &'a M::Value)>,
             M::Key: 'a,
             M::Value: 'a;
    fn insert<'a, Iter>(
        storage: &mut S,
        column: S::Column,
        set: Iter,
    ) -> StorageResult<()>
       where Iter: 'a + Iterator<Item = (&'a M::Key, &'a M::Value)>,
             M::Key: 'a,
             M::Value: 'a;
    fn remove<'a, Iter>(
        storage: &mut S,
        column: S::Column,
        set: Iter,
    ) -> StorageResult<()>
       where Iter: 'a + Iterator<Item = &'a M::Key>,
             M::Key: 'a;
}
Expand description

It is an extension of the blueprint that allows supporting batch operations. Usually, they are more performant than initializing/inserting/removing values one by one.

Required Methods§

source

fn init<'a, Iter>( storage: &mut S, column: S::Column, set: Iter, ) -> StorageResult<()>
where Iter: 'a + Iterator<Item = (&'a M::Key, &'a M::Value)>, M::Key: 'a, M::Value: 'a,

Initializes the storage with a bunch of key-value pairs. In some cases, this method may be more performant than Self::insert.

source

fn insert<'a, Iter>( storage: &mut S, column: S::Column, set: Iter, ) -> StorageResult<()>
where Iter: 'a + Iterator<Item = (&'a M::Key, &'a M::Value)>, M::Key: 'a, M::Value: 'a,

Inserts the batch of key-value pairs into the storage.

source

fn remove<'a, Iter>( storage: &mut S, column: S::Column, set: Iter, ) -> StorageResult<()>
where Iter: 'a + Iterator<Item = &'a M::Key>, M::Key: 'a,

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

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Column, M, S, KeyCodec, ValueCodec> SupportsBatching<M, S> for Plain<KeyCodec, ValueCodec>
where Column: StorageColumn, S: BatchOperations<Column = Column>, M: TableWithBlueprint<Blueprint = Plain<KeyCodec, ValueCodec>, Column = Column>, M::Blueprint: BlueprintMutate<M, S>,

source§

impl<Column, M, S, KeyCodec, ValueCodec, Metadata, Nodes, KeyConverter> SupportsBatching<M, S> for Sparse<KeyCodec, ValueCodec, Metadata, Nodes, KeyConverter>
where Column: StorageColumn, S: BatchOperations<Column = Column> + StorageMutate<M, Error = Error> + StorageMutate<Metadata, Error = Error> + StorageMutate<Nodes, Error = Error>, M: TableWithBlueprint<Blueprint = Sparse<KeyCodec, ValueCodec, Metadata, Nodes, KeyConverter>, Column = Column>, KeyCodec: Encode<M::Key> + Decode<M::OwnedKey>, ValueCodec: Encode<M::Value> + Decode<M::OwnedValue>, Metadata: Mappable<Value = SparseMerkleMetadata, OwnedValue = SparseMerkleMetadata>, Nodes: Mappable<Key = MerkleRoot, Value = Primitive, OwnedValue = Primitive> + TableWithBlueprint<Column = Column>, KeyConverter: PrimaryKey<InputKey = M::Key, OutputKey = Metadata::Key>, Nodes::Blueprint: BlueprintInspect<Nodes, S>,

source§

impl<M, S, KeyCodec, ValueCodec, Metadata, Nodes, Encoder> SupportsBatching<M, S> for Merklized<KeyCodec, ValueCodec, Metadata, Nodes, Encoder>
where M: Mappable, S: BatchOperations + StorageMutate<Metadata, Error = Error> + StorageMutate<Nodes, Error = Error>, KeyCodec: Encode<M::Key> + Decode<M::OwnedKey>, ValueCodec: Encode<M::Value> + Decode<M::OwnedValue>, Encoder: Encode<M::Value>, Metadata: Mappable<Key = DenseMetadataKey<M::OwnedKey>, OwnedKey = DenseMetadataKey<M::OwnedKey>, Value = DenseMerkleMetadata, OwnedValue = DenseMerkleMetadata>, Nodes: Mappable<Key = u64, Value = Primitive, OwnedValue = Primitive>, for<'a> StructuredStorage<&'a mut S>: StorageMutate<Metadata, Error = Error> + StorageMutate<Nodes, Error = Error>,