fuel_core_storage

Module blueprint

Source
Expand description

The module defines structures for the Mappable tables. Each table may have its blueprint that defines how it works with the storage. The table may have a plain blueprint that simply works in CRUD mode, or it may be an SMT-based blueprint that maintains a valid Merkle tree over the storage entries.

Modules§

  • The module defines the Merklized blueprint for the storage. The Merklized blueprint implements the binary merkle tree on top of the storage for all entries.
  • This module implements the plain blueprint for the storage. The plain blueprint is the simplest one. It doesn’t maintain any additional data structures and doesn’t provide any additional functionality. It is just a key-value store that encodes/decodes the key and value and puts/takes them into/from the storage.
  • The module defines the Sparse blueprint for the storage. The Sparse blueprint implements the sparse merkle tree on top of the storage. It is like a Plain blueprint that builds the sparse merkle tree parallel to the normal storage and maintains it.

Traits§

  • This trait allows defining the agnostic implementation for all storage traits(StorageInspect, StorageMutate, etc) while the main logic is hidden inside the blueprint. It allows quickly adding support for new structures only by implementing the trait and reusing the existing infrastructure in other places. It allows changing the blueprint on the fly in the definition of the table without affecting other areas of the codebase.
  • It is an extension of the BlueprintInspect that allows mutating the storage.
  • 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.
  • It is an extension of the blueprint that supporting creation of the Merkle tree over the storage.