CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
29 template<
typename TEncoder,
typename TDataSource,
typename THasher = std::hash<
typename TEncoder::KeyType>>
32 using KeyType =
typename TEncoder::KeyType;
45 if (!
m_tree.tryLoad(rootHash))
56 std::pair<Hash256, bool>
lookup(
const KeyType& key, std::vector<TreeNode>& nodePath)
const {
57 return m_tree.lookup(key, nodePath);
62 std::shared_ptr<DeltaType>
rebase() {
85 pDelta->setCheckpoint();
87 pDelta->copyRootTo(
m_tree);
88 pDelta->reset(pDelta->root());
BasePatriciaTree(TDataSource &dataSource, const Hash256 &rootHash)
Creates a tree around a dataSource with specified root hash (rootHash).
Definition: BasePatriciaTree.h:44
Represents a compact patricia tree.
Definition: PatriciaTree.h:28
std::weak_ptr< DeltaType > m_pWeakDelta
Definition: BasePatriciaTree.h:94
A base patricia tree.
Definition: BasePatriciaTree.h:30
std::shared_ptr< DeltaType > rebase()
Returns a delta based on the same data source as this tree.
Definition: BasePatriciaTree.h:62
typename TEncoder::ValueType ValueType
Definition: BasePatriciaTree.h:33
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
std::pair< Hash256, bool > lookup(const KeyType &key, std::vector< TreeNode > &nodePath) const
Tries to find the value associated with key in the tree and stores proof of existence or not in nodeP...
Definition: BasePatriciaTree.h:56
#define CATAPULT_THROW_RUNTIME_ERROR(MESSAGE)
Macro used to throw a catapult runtime error.
Definition: exceptions.h:167
BasePatriciaTree(TDataSource &dataSource)
Creates a tree around a dataSource.
Definition: BasePatriciaTree.h:38
Definition: AddressExtractionExtension.cpp:28
std::shared_ptr< DeltaType > rebaseDetached() const
Definition: BasePatriciaTree.h:73
TDataSource & m_dataSource
Definition: BasePatriciaTree.h:92
void commit()
Commits all changes in the rebased tree.
Definition: BasePatriciaTree.h:79
typename TEncoder::KeyType KeyType
Definition: BasePatriciaTree.h:32
PatriciaTree< TEncoder, TDataSource > m_tree
Definition: BasePatriciaTree.h:93
Hash256 root() const
Gets the root hash that uniquely identifies this tree.
Definition: BasePatriciaTree.h:51