CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
26 #include <unordered_map>
27 #include <unordered_set>
29 namespace catapult {
namespace tree {
32 template<
typename TEncoder,
typename TDataSource,
typename THasher>
35 using KeyType =
typename TEncoder::KeyType;
63 else if (!
m_tree.tryLoad(rootHash))
71 return m_tree.set(key, value);
87 template<
typename TDestinationDataSource>
91 dataSource.set(node.asLeafNode());
93 dataSource.set(node.asBranchNode());
98 template<
typename TTree>
100 auto rootHash =
root();
Represents a compact patricia tree.
Definition: PatriciaTree.h:28
utils::ByteArray< Hash256_Size, Hash256_tag > Hash256
Definition: src/catapult/types.h:47
void setCheckpoint()
Marks all nodes reachable at this point.
Definition: BasePatriciaTreeDelta.h:81
void copyRootTo(TTree &tree) const
Sets the root of tree to the root of this delta tree.
Definition: BasePatriciaTreeDelta.h:99
void forEach(const consumer< const TreeNode & > &consumer) const
Gets all nodes in memory and passes them to consumer.
Definition: ReadThroughMemoryDataSource.h:52
ReadThroughMemoryDataSource< TDataSource > m_dataSource
Definition: BasePatriciaTreeDelta.h:108
void copyPendingChangesTo(TDestinationDataSource &dataSource) const
Copies all pending changes to dataSource.
Definition: BasePatriciaTreeDelta.h:88
PatriciaTree< TEncoder, ReadThroughMemoryDataSource< TDataSource > > m_tree
Definition: BasePatriciaTreeDelta.h:110
void set(const KeyType &key, const ValueType &value)
Sets key to value in the tree.
Definition: BasePatriciaTreeDelta.h:70
bool unset(const KeyType &key)
Removes the value associated with key from the tree.
Definition: BasePatriciaTreeDelta.h:75
Hash256 root() const
Gets the root hash that uniquely identifies this tree.
Definition: BasePatriciaTreeDelta.h:49
typename TEncoder::ValueType ValueType
Definition: BasePatriciaTreeDelta.h:36
void reset(const Hash256 &rootHash)
Sets the root hash (rootHash).
Definition: BasePatriciaTreeDelta.h:60
Hash256 m_baseRootHash
Definition: BasePatriciaTreeDelta.h:109
std::unique_ptr< const TreeNode > get(const Hash256 &hash) const
Gets the tree node associated with hash.
Definition: ReadThroughMemoryDataSource.h:46
A delta on top of a base patricia tree that offers methods to set/unset nodes.
Definition: BasePatriciaTreeDelta.h:33
#define CATAPULT_THROW_RUNTIME_ERROR_1(MESSAGE, PARAM1)
Macro used to throw a catapult runtime error with a single parameter.
Definition: exceptions.h:171
Hash256 baseRoot() const
Gets the base root hash that identifies this tree before any changes are applied.
Definition: BasePatriciaTreeDelta.h:54
BasePatriciaTreeDelta(const TDataSource &dataSource, const Hash256 &rootHash)
Creates a tree around a dataSource with root rootHash.
Definition: BasePatriciaTreeDelta.h:40
typename TEncoder::KeyType KeyType
Definition: BasePatriciaTreeDelta.h:35
Definition: AddressExtractionExtension.cpp:28