Module merkletree::store

source ·
Expand description

Store implementations.

Structs

  • The Disk-only store is used to reduce memory to the minimum at the cost of build time performance. Most of its I/O logic is in the store_copy_from_slice and store_read_range functions.
  • The LevelCacheStore is used to reduce the on-disk footprint even further to the minimum at the cost of build time performance. Each LevelCacheStore is created with a StoreConfig object which contains the number of binary tree levels above the base that are ‘cached’. This implementation has hard requirements about the on disk file size based on that number of levels, so on-disk files are tied, structurally to the configuration they were built with and can only be accessed with the same number of levels.
  • Store that saves the data on disk, and accesses it using memmap.

Enums

Constants

  • Tree size (number of nodes) used as threshold to decide which build algorithm to use. Small trees (below this value) use the old build algorithm, optimized for speed rather than memory, allocating as much as needed to allow multiple threads to work concurrently without interrupting each other. Large trees (above) use the new build algorithm, optimized for memory rather than speed, allocating as less as possible with multiple threads competing to get the write lock.

Traits

  • Backing store of the merkle tree.