From 2d3668dc20c683ee0ec477418461bbc3fc690e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Tue, 31 Dec 2024 13:57:33 +0100 Subject: [PATCH] Move `nano::store::writer` enum to a dedicated header --- nano/node/confirming_set.cpp | 1 - nano/store/CMakeLists.txt | 4 +++- nano/store/write_queue.hpp | 17 ++--------------- nano/store/writers.cpp | 7 +++++++ nano/store/writers.hpp | 20 ++++++++++++++++++++ 5 files changed, 32 insertions(+), 17 deletions(-) create mode 100644 nano/store/writers.cpp create mode 100644 nano/store/writers.hpp diff --git a/nano/node/confirming_set.cpp b/nano/node/confirming_set.cpp index db7ca3e6a4..3da1e27448 100644 --- a/nano/node/confirming_set.cpp +++ b/nano/node/confirming_set.cpp @@ -8,7 +8,6 @@ #include #include #include -#include nano::confirming_set::confirming_set (confirming_set_config const & config_a, nano::ledger & ledger_a, nano::block_processor & block_processor_a, nano::stats & stats_a, nano::logger & logger_a) : config{ config_a }, diff --git a/nano/store/CMakeLists.txt b/nano/store/CMakeLists.txt index e3f4ef175a..4285ecfadf 100644 --- a/nano/store/CMakeLists.txt +++ b/nano/store/CMakeLists.txt @@ -105,7 +105,9 @@ add_library( version.cpp versioning.cpp write_queue.hpp - write_queue.cpp) + write_queue.cpp + writers.hpp + writers.cpp) target_link_libraries( nano_store diff --git a/nano/store/write_queue.hpp b/nano/store/write_queue.hpp index 95ae5a030a..6b9e32f496 100644 --- a/nano/store/write_queue.hpp +++ b/nano/store/write_queue.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include @@ -8,20 +9,6 @@ namespace nano::store { -/** Distinct areas write locking is done, order is irrelevant */ -enum class writer -{ - generic, - node, - block_processor, - confirmation_height, - pruning, - voting_final, - bounded_backlog, - online_weight, - testing // Used in tests to emulate a write lock -}; - class write_queue; class write_guard final @@ -80,4 +67,4 @@ class write_queue final std::function guard_finish_callback; }; -} // namespace nano::store +} diff --git a/nano/store/writers.cpp b/nano/store/writers.cpp new file mode 100644 index 0000000000..20f010b69e --- /dev/null +++ b/nano/store/writers.cpp @@ -0,0 +1,7 @@ +#include +#include + +std::string_view nano::store::to_string (nano::store::writer writer) +{ + return nano::enum_util::name (writer); +} \ No newline at end of file diff --git a/nano/store/writers.hpp b/nano/store/writers.hpp new file mode 100644 index 0000000000..2f2630b49b --- /dev/null +++ b/nano/store/writers.hpp @@ -0,0 +1,20 @@ +#pragma once + +namespace nano::store +{ +/** Distinct areas write locking is done, order is irrelevant */ +enum class writer +{ + generic, + node, + block_processor, + confirmation_height, + pruning, + voting_final, + bounded_backlog, + online_weight, + testing // Used in tests to emulate a write lock +}; + +std::string_view to_string (writer); +} \ No newline at end of file