diff --git a/category/execution/ethereum/db/trie_rodb.hpp b/category/execution/ethereum/db/trie_rodb.hpp index 80bb5617f..670bf1dc4 100644 --- a/category/execution/ethereum/db/trie_rodb.hpp +++ b/category/execution/ethereum/db/trie_rodb.hpp @@ -34,7 +34,7 @@ class TrieRODb final : public ::monad::Db { ::monad::mpt::RODb &db_; uint64_t block_number_; - ::monad::mpt::CacheNodeCursor prefix_cursor_; + ::monad::mpt::NodeCursor prefix_cursor_; public: TrieRODb(mpt::RODb &db) diff --git a/category/mpt/db.cpp b/category/mpt/db.cpp index 60764f39a..003db32c1 100644 --- a/category/mpt/db.cpp +++ b/category/mpt/db.cpp @@ -434,9 +434,9 @@ struct OnDiskWithWorkerThreadImpl struct RODbFiberFindOwningNodeRequest { - threadsafe_boost_fibers_promise> + threadsafe_boost_fibers_promise> *promise; - CacheNodeCursor start; + NodeCursor start; NibblesView key; uint64_t version; }; @@ -1068,7 +1068,7 @@ struct RODb::Impl final : public OnDiskWithWorkerThreadImpl } find_owning_cursor_result_type find_fiber_blocking( - CacheNodeCursor const &start, NibblesView const &key, + NodeCursor const &start, NibblesView const &key, uint64_t const version) { threadsafe_boost_fibers_promise promise; @@ -1087,7 +1087,7 @@ struct RODb::Impl final : public OnDiskWithWorkerThreadImpl return fut.get(); } - CacheNodeCursor load_root_fiber_blocking(uint64_t version) + NodeCursor load_root_fiber_blocking(uint64_t version) { auto const root_offset = aux().get_root_offset_at_version(version); if (root_offset == INVALID_OFFSET) { @@ -1140,8 +1140,8 @@ DbError find_result_to_db_error(find_result const result) noexcept } } -Result RODb::find( - CacheNodeCursor const &node_cursor, NibblesView const key, +Result RODb::find( + NodeCursor const &node_cursor, NibblesView const key, uint64_t const block_id) const { MONAD_ASSERT(impl_); @@ -1161,11 +1161,11 @@ Result RODb::find( return cursor; } -Result +Result RODb::find(NibblesView const key, uint64_t const block_id) const { MONAD_ASSERT(impl_); - CacheNodeCursor cursor = impl_->load_root_fiber_blocking(block_id); + NodeCursor cursor = impl_->load_root_fiber_blocking(block_id); return find(cursor, key, block_id); } @@ -1460,12 +1460,12 @@ namespace detail auto it = inflights.find(sender->block_id); auto pendings = std::move(it->second); inflights.erase(it); - std::shared_ptr root{}; + std::shared_ptr root{}; bool const block_alive_after_read = sender->context.aux.version_is_valid_ondisk(sender->block_id); if (block_alive_after_read) { sender->root = - detail::deserialize_node_from_receiver_result( + detail::deserialize_node_from_receiver_result( std::move(buffer_), buffer_off, io_state); root = sender->root; sender->res_root = {{sender->root}, find_result::success}; @@ -1546,7 +1546,7 @@ namespace detail return async::success(); } - auto cont = [this, io_state](std::shared_ptr root_) { + auto cont = [this, io_state](std::shared_ptr root_) { if (!root_) { res_root = {{}, find_result::version_no_longer_exist}; } @@ -1638,7 +1638,7 @@ namespace detail } template struct DbGetSender; - template struct DbGetSender>; + template struct DbGetSender>; } MONAD_MPT_NAMESPACE_END diff --git a/category/mpt/db.hpp b/category/mpt/db.hpp index fcb7dc940..6dc2e84d9 100644 --- a/category/mpt/db.hpp +++ b/category/mpt/db.hpp @@ -68,9 +68,9 @@ class RODb RODb &operator=(RODb const &) = delete; RODb &operator=(RODb &&) = delete; - Result - find(CacheNodeCursor const &, NibblesView, uint64_t block_id) const; - Result find(NibblesView prefix, uint64_t block_id) const; + Result + find(NodeCursor const &, NibblesView, uint64_t block_id) const; + Result find(NibblesView prefix, uint64_t block_id) const; uint64_t get_latest_version() const; uint64_t get_earliest_version() const; @@ -166,7 +166,7 @@ class Db struct AsyncContext { using inflight_root_t = unordered_dense_map< - uint64_t, std::vector)>>>; + uint64_t, std::vector)>>>; UpdateAux<> &aux; NodeCache node_cache; @@ -200,12 +200,12 @@ namespace detail op_get_node2 } op_type; - std::shared_ptr root; - CacheNodeCursor cur; + std::shared_ptr root; + NodeCursor cur; Nibbles const nv; uint64_t const block_id; - find_result_type res_root; + find_result_type res_root; find_result_type get_result; constexpr DbGetSender( @@ -216,13 +216,13 @@ namespace detail , nv(n) , block_id(block_id_) { - if constexpr (std::same_as>) { + if constexpr (std::same_as>) { MONAD_ASSERT(op_type == op_t::op_get_node1); } } constexpr DbGetSender( - AsyncContext &context_, op_t const op_type_, CacheNodeCursor cur_, + AsyncContext &context_, op_t const op_type_, NodeCursor cur_, NibblesView const n, uint64_t const block_id_) : context(context_) , op_type(op_type_) @@ -230,7 +230,7 @@ namespace detail , nv(n) , block_id(block_id_) { - if constexpr (std::same_as>) { + if constexpr (std::same_as>) { MONAD_ASSERT(op_type == op_t::op_get_node1); } } @@ -280,13 +280,13 @@ inline detail::DbGetSender make_get_data_sender( block_id}; } -inline detail::DbGetSender> make_get_node_sender( +inline detail::DbGetSender> make_get_node_sender( AsyncContext *const context, NibblesView const nv, uint64_t const block_id) { MONAD_ASSERT(context); return { *context, - detail::DbGetSender>::op_t::op_get_node1, + detail::DbGetSender>::op_t::op_get_node1, nv, block_id}; } diff --git a/category/mpt/deserialize_node_from_receiver_result.hpp b/category/mpt/deserialize_node_from_receiver_result.hpp index acabdf1cb..64a6259b3 100644 --- a/category/mpt/deserialize_node_from_receiver_result.hpp +++ b/category/mpt/deserialize_node_from_receiver_result.hpp @@ -53,20 +53,20 @@ namespace detail } } - template - inline NodeType::UniquePtr deserialize_node_from_receiver_result( + template + inline Node::UniquePtr deserialize_node_from_receiver_result( ResultType buffer_, uint16_t buffer_off, MONAD_ASYNC_NAMESPACE::erased_connected_operation *io_state) { MONAD_ASSERT(buffer_); - typename NodeType::UniquePtr node; + Node::UniquePtr node; if constexpr (std::is_same_v< std::decay_t, typename monad::async::read_single_buffer_sender:: result_type>) { auto &buffer = std::move(buffer_).assume_value().get(); MONAD_ASSERT(buffer.size() > buffer_off); - node = deserialize_node_from_buffer( + node = deserialize_node_from_buffer( (unsigned char *)buffer.data() + buffer_off, buffer.size() - buffer_off); buffer.reset(); @@ -82,7 +82,7 @@ namespace detail MONAD_ASSERT(buffer.size() > buffer_off); // Did the Receiver forget to set lifetime_managed_internally? MONAD_DEBUG_ASSERT(io_state->lifetime_is_managed_internally()); - node = deserialize_node_from_buffer( + node = deserialize_node_from_buffer( (unsigned char *)buffer.data() + buffer_off, buffer.size() - buffer_off); } diff --git a/category/mpt/find_notify_fiber.cpp b/category/mpt/find_notify_fiber.cpp index b642c7adb..f15f7c296 100644 --- a/category/mpt/find_notify_fiber.cpp +++ b/category/mpt/find_notify_fiber.cpp @@ -93,7 +93,7 @@ namespace auto const offset = parent->fnext(branch_index); auto node = parent->next(branch_index); if (node == nullptr) { - node = detail::deserialize_node_from_receiver_result( + node = detail::deserialize_node_from_receiver_result( std::move(buffer_), buffer_off, io_state); parent->set_next(branch_index, node); } @@ -151,7 +151,7 @@ namespace ResultType buffer_) { MONAD_ASSERT(buffer_); - CacheNodeCursor start_cursor{}; + NodeCursor start_cursor{}; // verify the offset it read is still valid and has not been reused // to write new data. auto const virtual_offset_after = aux->physical_to_virtual(offset); @@ -160,11 +160,11 @@ namespace NodeCache::ConstAccessor acc; MONAD_ASSERT(node_cache.find(acc, virtual_offset) == false); } - std::shared_ptr node = - detail::deserialize_node_from_receiver_result( + std::shared_ptr node = + detail::deserialize_node_from_receiver_result( std::move(buffer_), buffer_off, io_state); node_cache.insert(virtual_offset, node); - start_cursor = CacheNodeCursor{node}; + start_cursor = NodeCursor{node}; } auto it = inflights.find(virtual_offset); MONAD_ASSERT(it != inflights.end()); @@ -186,7 +186,7 @@ namespace { if (aux.io->owning_thread_id() != get_tl_tid()) { promise.set_value( - {CacheNodeCursor{}, + {NodeCursor{}, find_result::need_to_continue_in_io_thread}); return; } @@ -286,7 +286,7 @@ void find_notify_fiber_future( void find_owning_notify_fiber_future( UpdateAuxImpl &aux, NodeCache &node_cache, inflight_map_owning_t &inflights, threadsafe_boost_fibers_promise &promise, - CacheNodeCursor const &start, NibblesView const key, uint64_t const version) + NodeCursor const &start, NibblesView const key, uint64_t const version) { if (!aux.version_is_valid_ondisk(version)) { promise.set_value({start, find_result::version_no_longer_exist}); @@ -294,7 +294,7 @@ void find_owning_notify_fiber_future( } if (!start.is_valid()) { promise.set_value( - {CacheNodeCursor{}, find_result::root_node_is_null_failure}); + {NodeCursor{}, find_result::root_node_is_null_failure}); return; } unsigned prefix_index = 0; @@ -304,21 +304,21 @@ void find_owning_notify_fiber_future( ++node_prefix_index, ++prefix_index) { if (prefix_index >= key.nibble_size()) { promise.set_value( - {CacheNodeCursor{node, node_prefix_index}, + {NodeCursor{node, node_prefix_index}, find_result::key_ends_earlier_than_node_failure}); return; } if (key.get(prefix_index) != node->path_nibble_view().get(node_prefix_index)) { promise.set_value( - {CacheNodeCursor{node, node_prefix_index}, + {NodeCursor{node, node_prefix_index}, find_result::key_mismatch_failure}); return; } } if (prefix_index == key.nibble_size()) { promise.set_value( - {CacheNodeCursor{node, node_prefix_index}, find_result::success}); + {NodeCursor{node, node_prefix_index}, find_result::success}); return; } MONAD_ASSERT(prefix_index < key.nibble_size()); @@ -341,7 +341,7 @@ void find_owning_notify_fiber_future( // find in cache NodeCache::ConstAccessor acc; if (node_cache.find(acc, next_virtual_offset)) { - CacheNodeCursor next_cursor{acc->second->val.first}; + NodeCursor next_cursor{acc->second->val.first}; find_owning_notify_fiber_future( aux, node_cache, @@ -354,10 +354,10 @@ void find_owning_notify_fiber_future( } auto cont = [&aux, &node_cache, &inflights, &promise, next_key, version]( - CacheNodeCursor const &node_cursor) -> result { + NodeCursor const &node_cursor) -> result { if (!node_cursor.is_valid()) { promise.set_value( - {CacheNodeCursor{}, find_result::version_no_longer_exist}); + {NodeCursor{}, find_result::version_no_longer_exist}); return success(); } find_owning_notify_fiber_future( @@ -381,7 +381,7 @@ void find_owning_notify_fiber_future( } else { promise.set_value( - {CacheNodeCursor{node, node_prefix_index}, + {NodeCursor{node, node_prefix_index}, find_result::branch_not_exist_failure}); } } @@ -397,17 +397,17 @@ void load_root_notify_fiber_future( if (!aux.version_is_valid_ondisk(version) || root_virtual_offset == INVALID_VIRTUAL_OFFSET) { promise.set_value( - {CacheNodeCursor{}, find_result::version_no_longer_exist}); + {NodeCursor{}, find_result::version_no_longer_exist}); return; } NodeCache::ConstAccessor acc; if (node_cache.find(acc, root_virtual_offset)) { auto &root = acc->second->val.first; MONAD_ASSERT(root != nullptr); - promise.set_value({CacheNodeCursor{root}, find_result::success}); + promise.set_value({NodeCursor{root}, find_result::success}); return; } - auto cont = [&promise](CacheNodeCursor const &node_cursor) -> result { + auto cont = [&promise](NodeCursor const &node_cursor) -> result { if (!node_cursor.is_valid()) { promise.set_value( {node_cursor, find_result::version_no_longer_exist}); diff --git a/category/mpt/find_request_sender.hpp b/category/mpt/find_request_sender.hpp index 35d60f782..647fc849c 100644 --- a/category/mpt/find_request_sender.hpp +++ b/category/mpt/find_request_sender.hpp @@ -33,10 +33,10 @@ MONAD_MPT_NAMESPACE_BEGIN struct inflight_node_hasher { constexpr size_t operator()( - std::pair const &v) const noexcept + std::pair const &v) const noexcept { return virtual_chunk_offset_t_hasher{}(v.first) ^ - fnv1a_hash()(v.second); + fnv1a_hash()(v.second); } }; @@ -47,14 +47,14 @@ struct inflight_node_hasher // having a pointer to parent as key ensures requests share the same root node // as well. using AsyncInflightNodes = unordered_dense_map< - std::pair, + std::pair, std::vector< - std::function(CacheNodeCursor)>>, + std::function(NodeCursor)>>, inflight_node_hasher>; template concept return_type = - std::same_as || std::same_as>; + std::same_as || std::same_as>; /*! \brief Sender to perform the asynchronous finding of a node. */ @@ -67,7 +67,7 @@ class find_request_sender UpdateAuxImpl &aux_; NodeCache &node_cache_; - CacheNodeCursor root_; + NodeCursor root_; uint64_t version_; NibblesView key_; AsyncInflightNodes &inflights_; @@ -77,7 +77,7 @@ class find_request_sender MONAD_ASYNC_NAMESPACE::result resume_( MONAD_ASYNC_NAMESPACE::erased_connected_operation *io_state, - CacheNodeCursor root) + NodeCursor root) { if (!root.is_valid()) { // Version invalidated during async read @@ -95,7 +95,7 @@ class find_request_sender constexpr find_request_sender( UpdateAuxImpl &aux, NodeCache &node_cache, - AsyncInflightNodes &inflights, CacheNodeCursor root, uint64_t version, + AsyncInflightNodes &inflights, NodeCursor root, uint64_t version, NibblesView const key, bool const return_value) : aux_(aux) , node_cache_(node_cache) @@ -108,7 +108,7 @@ class find_request_sender MONAD_ASSERT(root_.is_valid()); } - void reset(CacheNodeCursor root, NibblesView key) + void reset(NodeCursor root, NibblesView key) { root_ = root; key_ = key; @@ -133,10 +133,10 @@ static_assert(sizeof(find_request_sender) == 128); static_assert(alignof(find_request_sender) == 8); static_assert(MONAD_ASYNC_NAMESPACE::sender>); -static_assert(sizeof(find_request_sender>) == 112); -static_assert(alignof(find_request_sender>) == 8); +static_assert(sizeof(find_request_sender>) == 112); +static_assert(alignof(find_request_sender>) == 8); static_assert(MONAD_ASYNC_NAMESPACE::sender< - find_request_sender>>); + find_request_sender>>); template struct find_request_sender::find_receiver @@ -185,13 +185,11 @@ struct find_request_sender::find_receiver MONAD_ASSERT(sender->root_.is_valid()); auto const next_offset = sender->root_.node->fnext(branch_index); auto const virt_offset = sender->aux_.physical_to_virtual(next_offset); - std::shared_ptr sp; + std::shared_ptr sp; if (this->virt_offset == virt_offset) { - sp = detail::deserialize_node_from_receiver_result( + sp = detail::deserialize_node_from_receiver_result( std::move(buffer_), buffer_off, io_state); - auto cache_it = sender->node_cache_.insert(virt_offset, sp); - auto *const list_node = &*cache_it->second; - sender->root_.node->set_next(branch_index, list_node); + sender->node_cache_.insert(virt_offset, sp); } auto key = std::pair(this->virt_offset, sender->root_.node.get()); auto it = sender->inflights_.find(key); @@ -199,7 +197,7 @@ struct find_request_sender::find_receiver auto pendings = std::move(it->second); sender->inflights_.erase(it); for (auto &invoc : pendings) { - MONAD_ASSERT(invoc(CacheNodeCursor{sp})); + MONAD_ASSERT(invoc(NodeCursor{sp})); } } } @@ -254,8 +252,6 @@ inline MONAD_ASYNC_NAMESPACE::result find_request_sender::operator()( key_ = key_.substr(static_cast(prefix_index) + 1u); auto const child_index = node->to_child_index(branch); NodeCache::ConstAccessor acc; - auto *p = reinterpret_cast( - node->next(child_index)); auto const offset = node->fnext(child_index); virtual_chunk_offset_t const virt_offset = aux_.physical_to_virtual(offset); @@ -265,17 +261,9 @@ inline MONAD_ASYNC_NAMESPACE::result find_request_sender::operator()( io_state->completed(success()); return success(); } - if (p != nullptr && p->key == virt_offset) { - // found cache entry with the desired key - root_ = {p->val.first}; - MONAD_ASSERT(root_.is_valid()); - continue; - } if (node_cache_.find(acc, virt_offset)) { - auto *const list_node = &*acc->second; - node->set_next(child_index, list_node); // found in LRU - no IO necessary - root_ = {list_node->val.first}; + root_ = {acc->second->val.first}; MONAD_ASSERT(root_.is_valid()); continue; } @@ -287,7 +275,7 @@ inline MONAD_ASYNC_NAMESPACE::result find_request_sender::operator()( } tid_checked_ = true; } - auto cont = [this, io_state](CacheNodeCursor root) -> result { + auto cont = [this, io_state](NodeCursor root) -> result { return this->resume_(io_state, root); }; auto offset_node = std::pair(virt_offset, node); diff --git a/category/mpt/node.cpp b/category/mpt/node.cpp index f0e04e21e..d75199b7a 100644 --- a/category/mpt/node.cpp +++ b/category/mpt/node.cpp @@ -48,14 +48,15 @@ MONAD_MPT_NAMESPACE_BEGIN Node::Node(prevent_public_construction_tag) {} -NodeBase::NodeBase( +Node::Node( prevent_public_construction_tag, uint16_t const mask, std::optional value, size_t const data_size, NibblesView const path, int64_t const version) : mask(mask) , path_nibble_index_end(path.end_nibble_) - , value_len(static_cast( - value.transform(&byte_string_view::size).value_or(0))) + , value_len( + static_cast( + value.transform(&byte_string_view::size).value_or(0))) , version(version) { MONAD_DEBUG_ASSERT( @@ -87,7 +88,7 @@ Node::~Node() } } -unsigned NodeBase::to_child_index(unsigned const branch) const noexcept +unsigned Node::to_child_index(unsigned const branch) const noexcept { // convert the enabled i'th bit in a 16-bit mask into its corresponding // index location - index @@ -95,20 +96,19 @@ unsigned NodeBase::to_child_index(unsigned const branch) const noexcept return bitmask_index(mask, branch); } -unsigned NodeBase::number_of_children() const noexcept +unsigned Node::number_of_children() const noexcept { return static_cast(std::popcount(mask)); } -chunk_offset_t const NodeBase::fnext(unsigned const index) const noexcept +chunk_offset_t const Node::fnext(unsigned const index) const noexcept { MONAD_DEBUG_ASSERT(index < number_of_children()); return unaligned_load( fnext_data + index * sizeof(chunk_offset_t)); } -void NodeBase::set_fnext( - unsigned const index, chunk_offset_t const off) noexcept +void Node::set_fnext(unsigned const index, chunk_offset_t const off) noexcept { std::memcpy( fnext_data + index * sizeof(chunk_offset_t), @@ -116,25 +116,25 @@ void NodeBase::set_fnext( sizeof(chunk_offset_t)); } -unsigned char *NodeBase::child_min_offset_fast_data() noexcept +unsigned char *Node::child_min_offset_fast_data() noexcept { return fnext_data + number_of_children() * sizeof(file_offset_t); } -unsigned char const *NodeBase::child_min_offset_fast_data() const noexcept +unsigned char const *Node::child_min_offset_fast_data() const noexcept { return fnext_data + number_of_children() * sizeof(file_offset_t); } compact_virtual_chunk_offset_t -NodeBase::min_offset_fast(unsigned const index) const noexcept +Node::min_offset_fast(unsigned const index) const noexcept { return unaligned_load( child_min_offset_fast_data() + index * sizeof(compact_virtual_chunk_offset_t)); } -void NodeBase::set_min_offset_fast( +void Node::set_min_offset_fast( unsigned const index, compact_virtual_chunk_offset_t const offset) noexcept { std::memcpy( @@ -144,27 +144,27 @@ void NodeBase::set_min_offset_fast( sizeof(compact_virtual_chunk_offset_t)); } -unsigned char *NodeBase::child_min_offset_slow_data() noexcept +unsigned char *Node::child_min_offset_slow_data() noexcept { return child_min_offset_fast_data() + number_of_children() * sizeof(compact_virtual_chunk_offset_t); } -unsigned char const *NodeBase::child_min_offset_slow_data() const noexcept +unsigned char const *Node::child_min_offset_slow_data() const noexcept { return child_min_offset_fast_data() + number_of_children() * sizeof(compact_virtual_chunk_offset_t); } compact_virtual_chunk_offset_t -NodeBase::min_offset_slow(unsigned const index) const noexcept +Node::min_offset_slow(unsigned const index) const noexcept { return unaligned_load( child_min_offset_slow_data() + index * sizeof(compact_virtual_chunk_offset_t)); } -void NodeBase::set_min_offset_slow( +void Node::set_min_offset_slow( unsigned const index, compact_virtual_chunk_offset_t const offset) noexcept { std::memcpy( @@ -174,25 +174,25 @@ void NodeBase::set_min_offset_slow( sizeof(compact_virtual_chunk_offset_t)); } -unsigned char *NodeBase::child_min_version_data() noexcept +unsigned char *Node::child_min_version_data() noexcept { return child_min_offset_slow_data() + number_of_children() * sizeof(compact_virtual_chunk_offset_t); } -unsigned char const *NodeBase::child_min_version_data() const noexcept +unsigned char const *Node::child_min_version_data() const noexcept { return child_min_offset_slow_data() + number_of_children() * sizeof(compact_virtual_chunk_offset_t); } -int64_t NodeBase::subtrie_min_version(unsigned const index) const noexcept +int64_t Node::subtrie_min_version(unsigned const index) const noexcept { return unaligned_load( child_min_version_data() + index * sizeof(int64_t)); } -void NodeBase::set_subtrie_min_version( +void Node::set_subtrie_min_version( unsigned const index, int64_t const min_version) noexcept { std::memcpy( @@ -201,17 +201,17 @@ void NodeBase::set_subtrie_min_version( sizeof(int64_t)); } -unsigned char *NodeBase::child_off_data() noexcept +unsigned char *Node::child_off_data() noexcept { return child_min_version_data() + number_of_children() * sizeof(int64_t); } -unsigned char const *NodeBase::child_off_data() const noexcept +unsigned char const *Node::child_off_data() const noexcept { return child_min_version_data() + number_of_children() * sizeof(int64_t); } -uint16_t NodeBase::child_data_offset(unsigned const index) const noexcept +uint16_t Node::child_data_offset(unsigned const index) const noexcept { MONAD_DEBUG_ASSERT(index <= number_of_children()); if (index == 0) { @@ -221,76 +221,76 @@ uint16_t NodeBase::child_data_offset(unsigned const index) const noexcept child_off_data() + (index - 1) * sizeof(uint16_t)); } -unsigned NodeBase::child_data_len(unsigned const index) const +unsigned Node::child_data_len(unsigned const index) const { return child_data_offset(index + 1) - child_data_offset(index); } -unsigned NodeBase::child_data_len() +unsigned Node::child_data_len() { return child_data_offset(number_of_children()) - child_data_offset(0); } -unsigned char *NodeBase::path_data() noexcept +unsigned char *Node::path_data() noexcept { return child_off_data() + number_of_children() * sizeof(uint16_t); } -unsigned char const *NodeBase::path_data() const noexcept +unsigned char const *Node::path_data() const noexcept { return child_off_data() + number_of_children() * sizeof(uint16_t); } -unsigned NodeBase::path_nibbles_len() const noexcept +unsigned Node::path_nibbles_len() const noexcept { MONAD_DEBUG_ASSERT( bitpacked.path_nibble_index_start <= path_nibble_index_end); return path_nibble_index_end - bitpacked.path_nibble_index_start; } -bool NodeBase::has_path() const noexcept +bool Node::has_path() const noexcept { return path_nibbles_len() > 0; } -unsigned NodeBase::path_bytes() const noexcept +unsigned Node::path_bytes() const noexcept { return (path_nibble_index_end + 1) / 2; } -NibblesView NodeBase::path_nibble_view() const noexcept +NibblesView Node::path_nibble_view() const noexcept { return NibblesView{ bitpacked.path_nibble_index_start, path_nibble_index_end, path_data()}; } -unsigned NodeBase::path_start_nibble() const noexcept +unsigned Node::path_start_nibble() const noexcept { return bitpacked.path_nibble_index_start; } -unsigned char *NodeBase::value_data() noexcept +unsigned char *Node::value_data() noexcept { return path_data() + path_bytes(); } -unsigned char const *NodeBase::value_data() const noexcept +unsigned char const *Node::value_data() const noexcept { return path_data() + path_bytes(); } -bool NodeBase::has_value() const noexcept +bool Node::has_value() const noexcept { return bitpacked.has_value; } -byte_string_view NodeBase::value() const noexcept +byte_string_view Node::value() const noexcept { MONAD_DEBUG_ASSERT(has_value()); return {value_data(), value_len}; } -std::optional NodeBase::opt_value() const noexcept +std::optional Node::opt_value() const noexcept { if (has_value()) { return value(); @@ -298,32 +298,32 @@ std::optional NodeBase::opt_value() const noexcept return std::nullopt; } -unsigned char *NodeBase::data_data() noexcept +unsigned char *Node::data_data() noexcept { return value_data() + value_len; } -unsigned char const *NodeBase::data_data() const noexcept +unsigned char const *Node::data_data() const noexcept { return value_data() + value_len; } -byte_string_view NodeBase::data() const noexcept +byte_string_view Node::data() const noexcept { return {data_data(), bitpacked.data_len}; } -unsigned char *NodeBase::child_data() noexcept +unsigned char *Node::child_data() noexcept { return data_data() + bitpacked.data_len; } -unsigned char const *NodeBase::child_data() const noexcept +unsigned char const *Node::child_data() const noexcept { return data_data() + bitpacked.data_len; } -byte_string_view NodeBase::child_data_view(unsigned const index) const noexcept +byte_string_view Node::child_data_view(unsigned const index) const noexcept { MONAD_DEBUG_ASSERT(index < number_of_children()); return byte_string_view{ @@ -331,49 +331,48 @@ byte_string_view NodeBase::child_data_view(unsigned const index) const noexcept static_cast(child_data_len(index))}; } -unsigned char *NodeBase::child_data(unsigned const index) noexcept +unsigned char *Node::child_data(unsigned const index) noexcept { MONAD_DEBUG_ASSERT(index < number_of_children()); return child_data() + child_data_offset(index); } -void NodeBase::set_child_data( - unsigned const index, byte_string_view data) noexcept +void Node::set_child_data(unsigned const index, byte_string_view data) noexcept { // called after data_off array is calculated std::memcpy(child_data(index), data.data(), data.size()); } -unsigned char *NodeBase::next_data() noexcept +unsigned char *Node::next_data() noexcept { return child_data() + child_data_offset(number_of_children()); } -unsigned char const *NodeBase::next_data() const noexcept +unsigned char const *Node::next_data() const noexcept { return child_data() + child_data_offset(number_of_children()); } // round up to 8-byte boundary -unsigned char *NodeBase::next_data_aligned() noexcept +unsigned char *Node::next_data_aligned() noexcept { return reinterpret_cast( round_up_align<3>(reinterpret_cast(next_data()))); } -unsigned char const *NodeBase::next_data_aligned() const noexcept +unsigned char const *Node::next_data_aligned() const noexcept { return reinterpret_cast( round_up_align<3>(reinterpret_cast(next_data()))); } -uint32_t NodeBase::get_disk_size() const noexcept +uint32_t Node::get_disk_size() const noexcept { MONAD_DEBUG_ASSERT(next_data() >= (unsigned char *)this); auto const node_disk_size = static_cast(next_data() - (unsigned char *)this); - uint32_t const total_disk_size = node_disk_size + NodeBase::disk_size_bytes; - MONAD_DEBUG_ASSERT(total_disk_size <= NodeBase::max_disk_size); + uint32_t const total_disk_size = node_disk_size + Node::disk_size_bytes; + MONAD_DEBUG_ASSERT(total_disk_size <= Node::max_disk_size); return total_disk_size; } @@ -412,35 +411,10 @@ Node::SharedPtr Node::move_next(unsigned const index) noexcept unsigned Node::get_mem_size() const noexcept { auto const *const end = - next_data_aligned() + sizeof(SharedPtr) * number_of_children(); + next_data_aligned() + sizeof(Node::SharedPtr) * number_of_children(); MONAD_DEBUG_ASSERT(end >= (unsigned char *)this); auto const mem_size = static_cast(end - (unsigned char *)this); - MONAD_DEBUG_ASSERT(mem_size <= NodeBase::max_size); - return mem_size; -} - -void *CacheNode::next(size_t const index) const noexcept -{ - return unaligned_load(next_data_aligned() + index * sizeof(Node *)); -} - -void CacheNode::set_next(unsigned const index, void *const ptr) noexcept -{ - ptr ? memcpy( - next_data_aligned() + index * sizeof(Node *), - &ptr, - sizeof(void *)) - : memset( - next_data_aligned() + index * sizeof(Node *), 0, sizeof(void *)); -} - -unsigned CacheNode::get_mem_size() const noexcept -{ - auto const *const end = - next_data_aligned() + sizeof(Node *) * number_of_children(); - MONAD_DEBUG_ASSERT(end >= (unsigned char *)this); - auto const mem_size = static_cast(end - (unsigned char *)this); - MONAD_DEBUG_ASSERT(mem_size <= NodeBase::max_size); + MONAD_DEBUG_ASSERT(mem_size <= Node::max_size); return mem_size; } diff --git a/category/mpt/node.hpp b/category/mpt/node.hpp index 3a41433cb..998f3c09f 100644 --- a/category/mpt/node.hpp +++ b/category/mpt/node.hpp @@ -123,31 +123,12 @@ We store node data to its parent's storage to avoid an extra read of child node to retrieve child data. */ -class Node; -class CacheNode; - -template -concept node_type = - std::same_as || std::same_as; - -class NodeBase +class Node final { -protected: struct prevent_public_construction_tag { }; - NodeBase() = default; - - NodeBase( - prevent_public_construction_tag, uint16_t mask, - std::optional value, size_t data_size, - NibblesView path, int64_t version); - - // Protected destructor to prevent destruction using pointer to NodeBase, - // so destructor does not need to be virtual - ~NodeBase() = default; - public: static constexpr size_t max_number_of_children = 16; static constexpr uint8_t max_data_len = (1U << 6) - 1; @@ -157,9 +138,6 @@ class NodeBase static constexpr size_t max_size = max_disk_size + max_number_of_children * KECCAK256_SIZE; - template - friend DestNodeType::UniquePtr copy_node(SrcNodeType const *const from); - /* 16-bit mask for children */ uint16_t mask{0}; @@ -216,6 +194,33 @@ class NodeBase // out of line allows us to transfer ownership of data array from old node // to new one, also help to keep allocated size as small as possible. + using Deleter = allocators::unique_ptr_aliasing_allocator_deleter< + &allocators::aliasing_allocator_pair>; + using UniquePtr = std::unique_ptr; + using SharedPtr = std::shared_ptr; + + Node(prevent_public_construction_tag); + + Node( + prevent_public_construction_tag tag, uint16_t mask, + std::optional value, size_t data_size, + NibblesView path, int64_t version); + + Node(Node const &) = delete; + Node(Node &&) = default; + ~Node(); + + template + static UniquePtr make(size_t bytes, Args &&...args) + { + MONAD_DEBUG_ASSERT(bytes <= Node::max_size); + return allocators::allocate_aliasing_unique< + &allocators::aliasing_allocator_pair>( + bytes, + prevent_public_construction_tag{}, + std::forward(args)...); + } + unsigned to_child_index(unsigned branch) const noexcept; unsigned number_of_children() const noexcept; @@ -282,7 +287,7 @@ class NodeBase void set_child_data(unsigned index, byte_string_view data) noexcept; //! next pointers -protected: +private: unsigned char *next_data() noexcept; unsigned char const *next_data() const noexcept; @@ -291,41 +296,7 @@ class NodeBase unsigned char const *next_data_aligned() const noexcept; uint32_t get_disk_size() const noexcept; -}; - -class Node final : public NodeBase -{ - -public: - using Deleter = allocators::unique_ptr_aliasing_allocator_deleter< - &allocators::aliasing_allocator_pair>; - using UniquePtr = std::unique_ptr; - using SharedPtr = std::shared_ptr; - - Node(prevent_public_construction_tag); - - Node( - prevent_public_construction_tag tag, uint16_t mask, - std::optional value, size_t data_size, - NibblesView path, int64_t version) - : NodeBase(tag, mask, value, data_size, path, version) - { - } - - Node(Node const &) = delete; - Node(Node &&) = default; - ~Node(); - - template - static UniquePtr make(size_t bytes, Args &&...args) - { - MONAD_DEBUG_ASSERT(bytes <= Node::max_size); - return allocators::allocate_aliasing_unique< - &allocators::aliasing_allocator_pair>( - bytes, - prevent_public_construction_tag{}, - std::forward(args)...); - } + unsigned get_mem_size() const noexcept; SharedPtr *child_ptr(unsigned index) noexcept; SharedPtr const *child_ptr(unsigned index) const noexcept; @@ -336,8 +307,6 @@ class Node final : public NodeBase void set_next(unsigned index, SharedPtr p) noexcept; SharedPtr move_next(unsigned const index) noexcept; - - unsigned get_mem_size() const noexcept; }; static_assert(std::is_standard_layout_v, "required by offsetof"); @@ -345,40 +314,6 @@ static_assert(std::is_standard_layout_v, "required by offsetof"); static_assert(sizeof(Node) == 16); static_assert(alignof(Node) == 8); -class CacheNode final : public NodeBase -{ -public: - using Deleter = allocators::unique_ptr_aliasing_allocator_deleter< - &allocators::aliasing_allocator_pair>; - using UniquePtr = std::unique_ptr; - - CacheNode(prevent_public_construction_tag) - : NodeBase() - { - } - - template - static UniquePtr make(size_t bytes, Args &&...args) - { - MONAD_DEBUG_ASSERT(bytes <= Node::max_size); - return allocators::allocate_aliasing_unique< - &allocators::aliasing_allocator_pair>( - bytes, - prevent_public_construction_tag{}, - std::forward(args)...); - } - - void *next(size_t const index) const noexcept; - void set_next(unsigned const index, void *const ptr) noexcept; - - unsigned get_mem_size() const noexcept; -}; - -static_assert(std::is_standard_layout_v, "required by offsetof"); - -static_assert(sizeof(CacheNode) == 16); -static_assert(alignof(CacheNode) == 8); - // ChildData is for temporarily holding a child's info, including child ptr, // file offset and hash data, in the update recursion. struct ChildData @@ -453,8 +388,7 @@ void serialize_node_to_buffer( unsigned char *write_pos, unsigned bytes_to_write, Node const &, uint32_t disk_size, unsigned offset = 0); -template -inline NodeType::UniquePtr +inline Node::UniquePtr deserialize_node_from_buffer(unsigned char const *read_pos, size_t max_bytes) { for (size_t n = 0; n < max_bytes; n += 64) { @@ -464,65 +398,38 @@ deserialize_node_from_buffer(unsigned char const *read_pos, size_t max_bytes) auto const disk_size = unaligned_load(read_pos); MONAD_ASSERT_PRINTF( disk_size <= max_bytes, "deserialized node disk size is %u", disk_size); - MONAD_ASSERT(disk_size > 0 && disk_size <= NodeBase::max_disk_size); - read_pos += NodeBase::disk_size_bytes; + MONAD_ASSERT(disk_size > 0 && disk_size <= Node::max_disk_size); + read_pos += Node::disk_size_bytes; // Load the on disk node auto const mask = unaligned_load(read_pos); auto const number_of_children = static_cast(std::popcount(mask)); - uint32_t const base_size = disk_size - NodeBase::disk_size_bytes; - if constexpr (std::same_as) { - auto const alloc_size = round_up_align<3>(base_size) + - number_of_children * sizeof(Node::SharedPtr); - auto node = NodeType::make(alloc_size); - std::copy_n(read_pos, base_size, (unsigned char *)node.get()); - for (unsigned i = 0; i < node->number_of_children(); ++i) { - new (node->child_ptr(i)) Node::SharedPtr(); - } - MONAD_ASSERT(alloc_size == node->get_mem_size()); - return node; - } - else { - auto const alloc_size = round_up_align<3>(base_size) + - number_of_children * sizeof(NodeType *); - auto node = NodeType::make(alloc_size); - std::copy_n(read_pos, base_size, (unsigned char *)node.get()); - std::memset( - node->next_data_aligned(), - 0, - number_of_children * sizeof(NodeType *)); - MONAD_ASSERT(alloc_size == node->get_mem_size()); - return node; + uint32_t const base_size = disk_size - Node::disk_size_bytes; + auto const alloc_size = round_up_align<3>(base_size) + + number_of_children * sizeof(Node::SharedPtr); + auto node = Node::make(alloc_size); + std::copy_n(read_pos, base_size, (unsigned char *)node.get()); + for (unsigned i = 0; i < node->number_of_children(); ++i) { + new (node->child_ptr(i)) Node::SharedPtr(); } + MONAD_ASSERT(alloc_size == node->get_mem_size()); + return node; } -template -DestNodeType::UniquePtr copy_node(SrcNodeType const *const from) +inline Node::UniquePtr copy_node(Node const *const from) { auto const number_of_children = from->number_of_children(); auto const base_size = static_cast( from->next_data_aligned() - (unsigned char *)from); - if constexpr (std::same_as) { - auto const alloc_size = round_up_align<3>(base_size) + - number_of_children * sizeof(Node::SharedPtr); - auto node_copy = DestNodeType::make(alloc_size); - std::copy_n( - (unsigned char *)from, base_size, (unsigned char *)node_copy.get()); - for (unsigned i = 0; i < number_of_children; ++i) { - new (node_copy->child_ptr(i)) Node::SharedPtr(); - } - return node_copy; - } - else { - auto const next_ptrs_size = number_of_children * sizeof(void *); - auto const alloc_size = round_up_align<3>(base_size) + next_ptrs_size; - auto node_copy = DestNodeType::make(alloc_size); - std::copy_n( - (unsigned char *)from, base_size, (unsigned char *)node_copy.get()); - // reset all in memory children - std::memset(node_copy->next_data_aligned(), 0, next_ptrs_size); - return node_copy; + auto const alloc_size = round_up_align<3>(base_size) + + number_of_children * sizeof(Node::SharedPtr); + auto node_copy = Node::make(alloc_size); + std::copy_n( + (unsigned char *)from, base_size, (unsigned char *)node_copy.get()); + for (unsigned i = 0; i < number_of_children; ++i) { + new (node_copy->child_ptr(i)) Node::SharedPtr(); } + return node_copy; } int64_t calc_min_version(Node const &); diff --git a/category/mpt/node_cache.hpp b/category/mpt/node_cache.hpp index d14959a20..2cc7d0159 100644 --- a/category/mpt/node_cache.hpp +++ b/category/mpt/node_cache.hpp @@ -29,12 +29,12 @@ MONAD_MPT_NAMESPACE_BEGIN class NodeCache final : private static_lru_cache< virtual_chunk_offset_t, - std::pair, unsigned>, + std::pair, unsigned>, virtual_chunk_offset_t_hasher> { // second in value is node size using Base = static_lru_cache< - virtual_chunk_offset_t, std::pair, unsigned>, + virtual_chunk_offset_t, std::pair, unsigned>, virtual_chunk_offset_t_hasher>; size_t max_bytes_; @@ -78,7 +78,7 @@ class NodeCache final Map::iterator insert( virtual_chunk_offset_t const &virt_offset, - std::shared_ptr const &sp) noexcept + std::shared_ptr const &sp) noexcept { MONAD_ASSERT(virt_offset != virtual_chunk_offset_t::invalid_value()); diff --git a/category/mpt/node_cursor.hpp b/category/mpt/node_cursor.hpp index 42f1ac244..06328ecfc 100644 --- a/category/mpt/node_cursor.hpp +++ b/category/mpt/node_cursor.hpp @@ -22,20 +22,19 @@ MONAD_MPT_NAMESPACE_BEGIN -template -struct NodeCursorBase +struct NodeCursor { - std::shared_ptr node{nullptr}; + std::shared_ptr node{nullptr}; unsigned prefix_index{0}; - constexpr NodeCursorBase() + constexpr NodeCursor() : node{nullptr} , prefix_index{0} { } - constexpr NodeCursorBase( - std::shared_ptr node_, unsigned prefix_index_ = 0) + constexpr NodeCursor( + std::shared_ptr node_, unsigned prefix_index_ = 0) : node{std::move(node_)} , prefix_index{prefix_index_} { @@ -47,13 +46,7 @@ struct NodeCursorBase } }; -using NodeCursor = NodeCursorBase; -using CacheNodeCursor = NodeCursorBase; - static_assert(sizeof(NodeCursor) == 24); static_assert(alignof(NodeCursor) == 8); -static_assert(sizeof(CacheNodeCursor) == 24); -static_assert(alignof(CacheNodeCursor) == 8); - MONAD_MPT_NAMESPACE_END diff --git a/category/mpt/read_node_blocking.cpp b/category/mpt/read_node_blocking.cpp index 9d5719c0d..9314c9682 100644 --- a/category/mpt/read_node_blocking.cpp +++ b/category/mpt/read_node_blocking.cpp @@ -67,7 +67,7 @@ Node::UniquePtr read_node_blocking( strerror(errno)); } return aux.version_is_valid_ondisk(version) - ? deserialize_node_from_buffer( + ? deserialize_node_from_buffer( buffer + buffer_off, size_t(bytes_read) - buffer_off) : Node::UniquePtr{}; } diff --git a/category/mpt/test/db_test.cpp b/category/mpt/test/db_test.cpp index 27aa92084..eb77f4016 100644 --- a/category/mpt/test/db_test.cpp +++ b/category/mpt/test/db_test.cpp @@ -566,10 +566,10 @@ TEST_F(OnDiskDbWithFileAsyncFixture, read_only_db_single_thread_async) ASSERT_TRUE(res.has_value()); EXPECT_EQ(res.value(), kv[1].second); }); - async_get>( + async_get>( make_get_node_sender( ctx.get(), prefix + kv[0].first, starting_block_id), - [&](result_t> res) { + [&](result_t> res) { ASSERT_TRUE(res.has_value()); EXPECT_EQ(res.value()->value(), kv[0].second); }); @@ -581,9 +581,9 @@ TEST_F(OnDiskDbWithFileAsyncFixture, read_only_db_single_thread_async) res.value(), 0x05a697d6698c55ee3e4d472c4907bca2184648bcfdd0e023e7ff7089dc984e7e_hex); }); - async_get>( + async_get>( make_get_node_sender(ctx.get(), prefix, starting_block_id), - [&](result_t> res) { + [&](result_t> res) { ASSERT_TRUE(res.has_value()); EXPECT_EQ( res.value()->data(), @@ -986,7 +986,7 @@ TEST_F(OnDiskDbWithFileAsyncFixture, async_get_node_then_async_traverse) // async get traverse root struct GetNodeReceiver { - using ResultType = monad::async::result>; + using ResultType = monad::async::result>; detail::TraverseSender traverse_sender; TraverseResult &result; @@ -1005,7 +1005,7 @@ TEST_F(OnDiskDbWithFileAsyncFixture, async_get_node_then_async_traverse) } else { traverse_sender.traverse_root = - copy_node(res.assume_value().get()); + copy_node(res.assume_value().get()); // issue async traverse auto *traverse_state = new auto(monad::async::connect( std::move(traverse_sender), TraverseReceiver{result})); diff --git a/category/mpt/test/mixed_async_sync_loads_test.cpp b/category/mpt/test/mixed_async_sync_loads_test.cpp index b18b368ce..8b4a7a21e 100644 --- a/category/mpt/test/mixed_async_sync_loads_test.cpp +++ b/category/mpt/test/mixed_async_sync_loads_test.cpp @@ -69,13 +69,13 @@ TEST_F(MixedAsyncSyncLoadsTest, works) monad::mpt::AsyncInflightNodes inflights; monad::mpt::NodeCache node_cache{ 1000 * monad::mpt::NodeCache::AVERAGE_NODE_SIZE}; - std::shared_ptr cache_root = copy_node(root.get()); + std::shared_ptr cache_root = copy_node(root.get()); auto state = monad::async::connect( monad::mpt::find_request_sender<>( aux, node_cache, inflights, - CacheNodeCursor{cache_root}, + NodeCursor{cache_root}, latest_version, key, true), diff --git a/category/mpt/test/monad_trie_test.cpp b/category/mpt/test/monad_trie_test.cpp index 12fa31bf8..f7bbd3992 100644 --- a/category/mpt/test/monad_trie_test.cpp +++ b/category/mpt/test/monad_trie_test.cpp @@ -711,13 +711,13 @@ int main(int argc, char *argv[]) bool &done; unsigned const n_slices; find_bytes_request_sender *sender{nullptr}; - CacheNodeCursor state_start; + NodeCursor state_start; monad::small_prng rand; monad::byte_string key; explicit receiver_t( uint64_t &ops_, bool &done_, unsigned n_slices_, - CacheNodeCursor begin, uint32_t id) + NodeCursor begin, uint32_t id) : ops(ops_) , done(done_) , n_slices(n_slices_) @@ -758,8 +758,8 @@ int main(int argc, char *argv[]) NodeCache node_cache{1000 * NodeCache::AVERAGE_NODE_SIZE}; std::vector> states; states.reserve(random_read_benchmark_threads); - std::shared_ptr start_node = - copy_node(state_start.node.get()); + std::shared_ptr start_node = + copy_node(state_start.node.get()); for (uint32_t n = 0; n < random_read_benchmark_threads; n++) { states.emplace_back(new auto(connect( *aux.io, @@ -767,7 +767,7 @@ int main(int argc, char *argv[]) aux, node_cache, inflights, - CacheNodeCursor{start_node}, + NodeCursor{start_node}, aux.db_history_max_version(), NibblesView{}, true}, @@ -775,7 +775,7 @@ int main(int argc, char *argv[]) ops, signal_done, n_slices, - CacheNodeCursor{start_node}, + NodeCursor{start_node}, n)))); } diff --git a/category/mpt/test/node_lru_cache_test.cpp b/category/mpt/test/node_lru_cache_test.cpp index a6d564eba..1626fdab6 100644 --- a/category/mpt/test/node_lru_cache_test.cpp +++ b/category/mpt/test/node_lru_cache_test.cpp @@ -33,7 +33,7 @@ TEST(NodeCache, works) auto make_node = [&](uint32_t v) { monad::byte_string value(84, 0); memcpy(value.data(), &v, 4); - std::shared_ptr node = copy_node( + std::shared_ptr node = copy_node( monad::mpt::make_node(0, {}, {}, std::move(value), 0, 0).get()); MONAD_ASSERT(node->get_mem_size() == NodeCache::AVERAGE_NODE_SIZE); return node; @@ -78,7 +78,7 @@ TEST(NodeCache, works) monad::byte_string large_value(84 * 3, 0); memcpy(large_value.data(), "hihi", 4); - auto node = copy_node( + auto node = copy_node( monad::mpt::make_node(0, {}, {}, std::move(large_value), 0, 0).get()); EXPECT_EQ(node->get_mem_size(), 272); node_cache.insert(virtual_chunk_offset_t(6, 0, 1), std::move(node)); diff --git a/category/mpt/traverse.hpp b/category/mpt/traverse.hpp index 0205d2bc0..52e5370df 100644 --- a/category/mpt/traverse.hpp +++ b/category/mpt/traverse.hpp @@ -165,7 +165,7 @@ namespace detail } else { // version is valid after reading the buffer auto next_node_on_disk = - deserialize_node_from_receiver_result( + deserialize_node_from_receiver_result( std::move(buffer_), buffer_off, io_state); sender->within_recursion_count++; async_parallel_preorder_traverse_impl( diff --git a/category/mpt/trie.cpp b/category/mpt/trie.cpp index b861dbb90..67f341e7a 100644 --- a/category/mpt/trie.cpp +++ b/category/mpt/trie.cpp @@ -236,7 +236,7 @@ struct load_all_impl_ MONAD_ASSERT(root.node->next(branch_index) == nullptr); root.node->set_next( branch_index, - detail::deserialize_node_from_receiver_result( + detail::deserialize_node_from_receiver_result( std::move(buffer_), buffer_off, io_state)); impl->nodes_loaded++; } @@ -333,7 +333,7 @@ struct node_receiver_t void set_value(erased_connected_operation *io_state_, Result buffer_) { MONAD_ASSERT(buffer_); - auto as_node = detail::deserialize_node_from_receiver_result( + auto as_node = detail::deserialize_node_from_receiver_result( std::move(buffer_), buffer_offset, io_state_); cont(std::move(as_node)); } diff --git a/category/mpt/trie.hpp b/category/mpt/trie.hpp index 64b96fa25..2e59324d4 100644 --- a/category/mpt/trie.hpp +++ b/category/mpt/trie.hpp @@ -1057,7 +1057,7 @@ template using find_result_type = std::pair; using find_cursor_result_type = find_result_type; -using find_owning_cursor_result_type = find_result_type; +using find_owning_cursor_result_type = find_result_type; using inflight_map_t = unordered_dense_map< chunk_offset_t, @@ -1068,7 +1068,7 @@ using inflight_map_t = unordered_dense_map< using inflight_map_owning_t = unordered_dense_map< virtual_chunk_offset_t, std::vector( - CacheNodeCursor const &)>>, + NodeCursor const &)>>, virtual_chunk_offset_t_hasher>; // The request type to put to the fiber buffered channel for triedb thread @@ -1097,7 +1097,7 @@ void find_notify_fiber_future( void find_owning_notify_fiber_future( UpdateAuxImpl &, NodeCache &, inflight_map_owning_t &, threadsafe_boost_fibers_promise &promise, - CacheNodeCursor const &start, NibblesView, uint64_t version); + NodeCursor const &start, NibblesView, uint64_t version); // rodb load root void load_root_notify_fiber_future(