From 9650a8dda39a9cae0b0deaf7a3d4319f5bc22ba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Mon, 26 Sep 2022 17:06:03 +0200 Subject: [PATCH] Replace random_access with sequenced in `unchecked_map` (#3956) --- nano/node/unchecked_map.cpp | 2 +- nano/node/unchecked_map.hpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/nano/node/unchecked_map.cpp b/nano/node/unchecked_map.cpp index bcc1064a..9c3e7a9e 100644 --- a/nano/node/unchecked_map.cpp +++ b/nano/node/unchecked_map.cpp @@ -231,7 +231,7 @@ void nano::unchecked_map::insert_impl (nano::write_transaction const & transacti entries->template get ().insert ({ key, info }); while (entries->size () > mem_block_count_max) { - entries->template get ().pop_front (); + entries->template get ().pop_front (); } } } diff --git a/nano/node/unchecked_map.hpp b/nano/node/unchecked_map.hpp index c48c9a27..f71339e1 100644 --- a/nano/node/unchecked_map.hpp +++ b/nano/node/unchecked_map.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -24,16 +25,10 @@ class unchecked_key; class write_transaction; class unchecked_map { - class tag_random_access - { - }; - class tag_root - { - }; - public: unchecked_map (nano::store & store, bool const & do_delete); ~unchecked_map (); + void put (nano::hash_or_account const & dependency, nano::unchecked_info const & info); void for_each ( nano::transaction const & transaction, std::function action, std::function predicate = [] () { return true; }); @@ -90,14 +85,19 @@ private: // In memory store nano::unchecked_key key; nano::unchecked_info info; }; + // clang-format off + class tag_sequenced {}; + class tag_root {}; + using ordered_unchecked = boost::multi_index_container>, + mi::random_access>, mi::ordered_unique, mi::member>>>; // clang-format on std::unique_ptr entries; + mutable std::recursive_mutex entries_mutex; }; }