17 auto key = visit_in_place(
27 OUTCOME_TRY(key_opt, map.
tryLoad(key));
29 return std::move(key_opt);
33 const std::vector<std::pair<common::Buffer, common::Buffer>> &key_vals) {
37 for (
const auto &[key, val] : key_vals) {
38 [[maybe_unused]]
auto res = trie.put(key, val);
39 BOOST_ASSERT_MSG(res.has_value(),
"Insertion into trie failed");
41 auto root = trie.getRoot();
42 if (root ==
nullptr) {
46 auto encode_res = codec.encodeNode(*root);
47 BOOST_ASSERT_MSG(encode_res.has_value(),
"Trie encoding failed");
48 return codec.hash256(encode_res.value());
Class represents arbitrary (including empty) byte buffer.
outcome::result< std::optional< common::Buffer > > idToLookupKey(const ReadableBufferStorage &map, const primitives::BlockId &id)
common::Buffer numberToIndexKey(primitives::BlockNumber n)
boost::variant< BlockHash, BlockNumber > BlockId
Block id is the variant over BlockHash and BlockNumber.
storage::trie::RootHash trieRoot(const std::vector< std::pair< common::Buffer, common::Buffer >> &key_vals)
common::Buffer prependPrefix(common::BufferView key, prefix::Prefix key_column)
virtual outcome::result< std::optional< V > > tryLoad(const Key &key) const =0
Load value by key.