[][src]Module merkletree::merkle

Merkle tree abstractions, implementation and algorithms.

Structs

DiskStore

Disk-only store use 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.

MerkleTree

Merkle Tree.

MmapStore
VecStore

Constants

BUILD_CHUNK_NODES
BUILD_LEAVES_BLOCK_SIZE
SMALL_TREE_BUILD

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

Element

Element stored in the merkle tree.

Store

Backing store of the merkle tree.

Functions

log2_pow2

find power of 2 of a number which is power of 2

next_pow2

next_pow2 returns next highest power of two from a given number if it is not already a power of two.