CatapultServer
v0.5.0.1 (Elephant)
|
A patricia tree memory data source. More...
Public Member Functions | |
MemoryDataSource (DataSourceVerbosity verbosity=DataSourceVerbosity::Off) | |
Creates a data source with specified verbosity. More... | |
size_t | size () const |
Gets the number of saved nodes. More... | |
std::unique_ptr< const TreeNode > | get (const Hash256 &hash) const |
Gets the tree node associated with hash. More... | |
void | forEach (const consumer< const TreeNode & > &consumer) const |
Gets all nodes and passes them to consumer. More... | |
void | set (const LeafTreeNode &node) |
Saves a leaf tree node. More... | |
void | set (const BranchTreeNode &node) |
Saves a branch tree node. More... | |
void | clear () |
Clears all nodes. More... | |
Private Member Functions | |
template<typename TNode > | |
void | save (const TNode &node) |
Private Attributes | |
bool | m_isVerbose |
std::unordered_map< Hash256, std::unique_ptr< TreeNode >, utils::ArrayHasher< Hash256 > > | m_nodes |
A patricia tree memory data source.
|
explicit |
Creates a data source with specified verbosity.
void catapult::tree::MemoryDataSource::clear | ( | ) |
Clears all nodes.
void catapult::tree::MemoryDataSource::forEach | ( | const consumer< const TreeNode & > & | consumer | ) | const |
Gets all nodes and passes them to consumer.
std::unique_ptr< const TreeNode > catapult::tree::MemoryDataSource::get | ( | const Hash256 & | hash | ) | const |
Gets the tree node associated with hash.
|
inlineprivate |
void catapult::tree::MemoryDataSource::set | ( | const BranchTreeNode & | node | ) |
Saves a branch tree node.
void catapult::tree::MemoryDataSource::set | ( | const LeafTreeNode & | node | ) |
Saves a leaf tree node.
size_t catapult::tree::MemoryDataSource::size | ( | ) | const |
Gets the number of saved nodes.
|
private |
|
private |