Skip to main content

Crate firewood_storage

Crate firewood_storage 

Source
Expand description

§storage implements the storage of a Node on top of a LinearStore

Nodes are stored at a LinearAddress within a ReadableStorage.

The NodeStore maintains a free list and the LinearAddress of a root node.

A NodeStore is backed by a ReadableStorage which is persisted storage.

Modules§

logger
Logger module for handling logging functionality
macros
Macros module for defining macros used in the storage module
registry
Metrics registry for storage layer metrics Storage layer metric definitions.

Macros§

noop
A noop logger, when the logger feature is disabled

Structs§

AreaIndex
The type that uniquely identifies a valid area size. This is not usize because we store this as a single byte
BranchNode
A branch node
CheckOpt
Options for the checker
CheckerReport
Report of the checker results.
Children
Type alias for a collection of children in a branch node.
Committed
A committed revision of a merkle trie.
DBStats
All statistics about the given database image
DuplicateKeyError
A duplicate key error when merging two key-value tries.
FileBacked
A ReadableStorage and WritableStorage backed by a file
FileIoError
An error that occurs when reading or writing to a ReadableStorage or WritableStorage
FreeListsStats
Statistics about the free list
HashableShunt
A shunt for a hasheable trie that we can use to compute the hash of a node using component parts.
HashedKeyValueTrieRoot
The root of a hashed key-value trie.
ImmutableProposal
Contains state for a proposed revision of the trie.
InvalidTrieHashLength
An error that occurs when trying to convert a slice to a TrieHash
IterAscending
A marker type for TrieEdgeIter that indicates that the iterator traverses the trie in ascending order.
IterDescending
A marker type for TrieEdgeIter that indicates that the iterator traverses the trie in descending order.
JoinedPath
Joins two path segments into a single path, retaining the original segments without needing to allocate a new contiguous array.
KeyValueTrieRoot
The root of a key-value trie.
LeafNode
A leaf node
LinearAddress
A linear address in the nodestore storage.
MaybePersistedNode
A node that is either in memory or on disk.
MemStore
An in-memory impelementation of WritableStorage and ReadableStorage
Mutable
Contains the state of a nodestore that is still being modified.
NibblesIterator
Iterates over the nibbles in data. That is, each byte in data is converted to two nibbles.
NodeHashAlgorithmTryFromIntError
An error indicating that an integer could not be converted into a NodeHashAlgorithm.
NodeStore
Contains the state of a revision of a merkle trie.
NodeStoreHeader
Persisted metadata for a NodeStore. The NodeStoreHeader is at the start of the ReadableStorage.
PackedBytes
An iterator over the components of a path that yields them packed into bytes.
PackedPathComponents
An iterator over the components of a PackedPathRef.
PackedPathRef
A packed representation of a trie path where each byte encodes two path components.
Path
Path is part or all of a node’s path in the trie. Each element is a nibble.
PathCommonPrefix
The common prefix of two paths, along with their respective suffixes.
PathComponent
A path component in a hexary trie; which is only 4 bits (aka a nibble).
PathGuard
A RAII guard that resets a path buffer to its original length when dropped.
PathIterItem
A path iterator item, which has the key nibbles up to this point, a node, the address of the node, and the nibble that points to the next child down the list
Propose
Proposal-specific fields for a mutable nodestore.
Recon
Reconstruction-specific marker for a mutable nodestore. Zero-size: no delete list and no parent are needed for linear reconstruction chains.
Reconstructed
Contains state for a reconstructed revision of the trie. These are unparented, and only contain an in-memory root.
RootStore
This structure holds everything related to an open root store
TrieEdgeIter
An iterator over the edges in a key-value trie in a specified order.
TrieHash
A hash value inside a merkle trie We use the same type as returned by sha2 here to avoid copies
TrieStats
Statistics about the trie
TrieValueIter
An iterator over the key-value pairs in a key-value trie.
TryFromIntError
An error similar to std::num::TryFromIntError but able to be created within our crate.
U4
A 4-bit unsigned integer representing a hexary digit (0-15, inclusive) used as a path component in hexary tries.

Enums§

CacheReadStrategy
The strategy for caching nodes that are read from the storage layer. Generally, we only want to cache write operations, but for some read-heavy workloads you can enable caching of branch reads or all reads.
CheckerError
Errors returned by the checker
Child
A child of a branch node.
FreeListParent
This enum encapsulates what points to the stored area allocated for a free list.
Node
A node, either a Branch or Leaf
NodeHashAlgorithm
The hash algorithm used by the node store.
PartialPath
A trie path represented as a slice of path components, either borrowed or owned.
StoredAreaParent
This enum encapsulates what points to the stored area.
TrieEdgeState
The state of an edge from a parent node to a child node in a trie.
TrieNodeParent
This enum encapsulates what points to the stored area allocated for a trie node.
ValueDigest
A ValueDigest is either a node’s value or the hash of its value.

Traits§

Hashable
A node in the trie that can be hashed.
HashedNodeReader
Reads from an immutable (i.e. already hashed) merkle trie.
HashedTrieNode
A merkleized node in a fixed-arity radix trie.
IntoHashType
A trait to convert a value into a HashType.
IntoSplitPath
A type that can be converted into a splittable path.
MutableKind
Behaviour that differs between proposal and reconstruction mutable nodestores.
NodeReader
Reads nodes from a merkle trie.
Parentable
Some nodestore kinds implement Parentable.
PathComponentSliceExt
Extension methods for slices of path components.
Preimage
A preimage of a hash.
ReadableStorage
Trait for readable storage.
ReconstructionSource
Marker trait for nodestore states that can serve as the source for reconstruction.
RootReader
Reads the root of a merkle trie.
SplitPath
A trie path that can be (cheaply) split into two sub-paths.
TrieNode
A node in a fixed-arity radix trie.
TriePath
A trie path of components with different underlying representations.
TriePathAsPackedBytes
Converts this path to an iterator over its packed bytes.
TriePathFromPackedBytes
Constructor for a trie path from a set of packed bytes; where each byte contains as many path components as possible.
TriePathFromUnpackedBytes
Constructor for a trie path from a set of unpacked bytes; where each byte is a whole path component regardless of the normal width of a path component.
TrieReader
Reads nodes and the root address from a merkle trie.
WritableStorage
Trait for writable storage.

Functions§

hash_node
Returns the hash of node, which is at the given path_prefix.
hash_preimage
Returns the serialized representation of node used as the pre-image when hashing the node. The node is at the given path_prefix.

Type Aliases§

ChildrenSlots
Type alias for an iterator over the slots of a branch node’s children with its corresponding PathComponent.
ComponentIter
An iterator over path components.
HashType
The type of a hash. For non-ethereum compatible hashes, this is always a TrieHash.
PathBuf
An owned buffer of path components.
SharedNode
A shared node, which is just a triophe Arc of a node