6 #ifndef KAGOME_STORAGE_TRIE_POLKADOT_TRIE_HPP 7 #define KAGOME_STORAGE_TRIE_POLKADOT_TRIE_HPP 22 ReadOnlyMap<common::Buffer, common::Buffer, common::BufferView>,
25 using NodePtr = std::shared_ptr<TrieNode>;
30 std::shared_ptr<OpaqueTrieNode>
const &)>;
48 virtual outcome::result<std::tuple<bool, uint32_t>>
clearPrefix(
50 std::optional<uint64_t> limit,
51 const OnDetachCallback &callback) = 0;
64 const BranchNode &parent, uint8_t idx)
const = 0;
72 virtual outcome::result<NodePtr>
getNode(
74 virtual outcome::result<ConstNodePtr>
getNode(
85 const std::function<outcome::result<void>(
86 BranchNode const &, uint8_t idx)> &callback)
const = 0;
88 virtual std::unique_ptr<PolkadotTrieCursor>
trieCursor() = 0;
90 std::unique_ptr<Cursor>
cursor() final {
95 const std::shared_ptr<OpaqueTrieNode> &node) {
98 or std::dynamic_pointer_cast<TrieNode>(node) !=
nullptr,
99 "Unexpected Dummy node.");
100 return std::dynamic_pointer_cast<
TrieNode>(node);
106 #endif // KAGOME_STORAGE_TRIE_POLKADOT_TRIE_HPP
std::shared_ptr< TrieNode > NodePtr
An mixin for modifiable map.
virtual outcome::result< ConstNodePtr > retrieveChild(const BranchNode &parent, uint8_t idx) const =0
std::function< outcome::result< void >(const common::BufferView &key, std::optional< common::Buffer > &&value)> OnDetachCallback
std::shared_ptr< BranchNode > BranchPtr
virtual std::unique_ptr< PolkadotTrieCursor > trieCursor()=0
std::unique_ptr< Cursor > cursor() final
Returns new key-value iterator.
std::shared_ptr< const BranchNode > ConstBranchPtr
std::function< outcome::result< NodePtr >(std::shared_ptr< OpaqueTrieNode > const &)> NodeRetrieveFunctor
std::shared_ptr< const TrieNode > ConstNodePtr
virtual outcome::result< NodePtr > getNode(ConstNodePtr parent, const NibblesView &key_nibbles)=0
virtual outcome::result< std::tuple< bool, uint32_t > > clearPrefix(const common::BufferView &prefix, std::optional< uint64_t > limit, const OnDetachCallback &callback)=0
virtual NodePtr getRoot()=0
virtual outcome::result< void > forNodeInPath(ConstNodePtr parent, const NibblesView &path, const std::function< outcome::result< void >(BranchNode const &, uint8_t idx)> &callback) const =0
static outcome::result< NodePtr > defaultNodeRetrieveFunctor(const std::shared_ptr< OpaqueTrieNode > &node)