Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace random_access with sequenced in vote_cache #3955

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions nano/node/vote_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@ void nano::vote_cache::trim_overflow_locked ()
// When cache overflown remove the oldest entry
if (cache.size () > max_size)
{
cache.get<tag_random_access> ().pop_front ();
cache.get<tag_sequenced> ().pop_front ();
}
if (queue.size () > max_size)
{
queue.get<tag_random_access> ().pop_front ();
queue.get<tag_sequenced> ().pop_front ();
}
}

Expand Down
6 changes: 3 additions & 3 deletions nano/node/vote_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,15 @@ class vote_cache final
const std::size_t max_size;

// clang-format off
class tag_random_access {};
class tag_sequenced {};
class tag_tally {};
class tag_hash {};
// clang-format on

// clang-format off
using ordered_cache = boost::multi_index_container<entry,
mi::indexed_by<
mi::random_access<mi::tag<tag_random_access>>,
mi::sequenced<mi::tag<tag_sequenced>>,
mi::hashed_unique<mi::tag<tag_hash>,
mi::member<entry, nano::block_hash, &entry::hash>>>>;
// clang-format on
Expand All @@ -159,7 +159,7 @@ class vote_cache final
// clang-format off
using ordered_queue = boost::multi_index_container<queue_entry,
mi::indexed_by<
mi::random_access<mi::tag<tag_random_access>>,
mi::sequenced<mi::tag<tag_sequenced>>,
mi::ordered_non_unique<mi::tag<tag_tally>,
mi::member<queue_entry, nano::uint128_t, &queue_entry::tally>>,
mi::hashed_unique<mi::tag<tag_hash>,
Expand Down