From c69b7f8f919b8dfcab638cd08162d2899cabf131 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Wed, 1 May 2024 16:22:31 -0400 Subject: [PATCH] Style: factor enums to own files. --- Makefile.am | 2 + .../libbitcoin-database.vcxproj | 2 + .../libbitcoin-database.vcxproj.filters | 6 ++ include/bitcoin/database.hpp | 2 + include/bitcoin/database/store.hpp | 87 +------------------ include/bitcoin/database/tables/event.hpp | 50 +++++++++++ include/bitcoin/database/tables/table.hpp | 87 +++++++++++++++++++ include/bitcoin/database/tables/tables.hpp | 2 + 8 files changed, 153 insertions(+), 85 deletions(-) create mode 100644 include/bitcoin/database/tables/event.hpp create mode 100644 include/bitcoin/database/tables/table.hpp diff --git a/Makefile.am b/Makefile.am index 0d3409b3..1cfe5fb5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -210,7 +210,9 @@ include_bitcoin_database_primitives_HEADERS = \ include_bitcoin_database_tablesdir = ${includedir}/bitcoin/database/tables include_bitcoin_database_tables_HEADERS = \ include/bitcoin/database/tables/context.hpp \ + include/bitcoin/database/tables/event.hpp \ include/bitcoin/database/tables/schema.hpp \ + include/bitcoin/database/tables/table.hpp \ include/bitcoin/database/tables/tables.hpp include_bitcoin_database_tables_archivesdir = ${includedir}/bitcoin/database/tables/archives diff --git a/builds/msvc/vs2022/libbitcoin-database/libbitcoin-database.vcxproj b/builds/msvc/vs2022/libbitcoin-database/libbitcoin-database.vcxproj index 7542c098..02715535 100644 --- a/builds/msvc/vs2022/libbitcoin-database/libbitcoin-database.vcxproj +++ b/builds/msvc/vs2022/libbitcoin-database/libbitcoin-database.vcxproj @@ -130,11 +130,13 @@ + + diff --git a/builds/msvc/vs2022/libbitcoin-database/libbitcoin-database.vcxproj.filters b/builds/msvc/vs2022/libbitcoin-database/libbitcoin-database.vcxproj.filters index 7c3068ec..2df83fe8 100644 --- a/builds/msvc/vs2022/libbitcoin-database/libbitcoin-database.vcxproj.filters +++ b/builds/msvc/vs2022/libbitcoin-database/libbitcoin-database.vcxproj.filters @@ -242,6 +242,9 @@ include\bitcoin\database\tables + + include\bitcoin\database\tables + include\bitcoin\database\tables\indexes @@ -257,6 +260,9 @@ include\bitcoin\database\tables + + include\bitcoin\database\tables + include\bitcoin\database\tables diff --git a/include/bitcoin/database.hpp b/include/bitcoin/database.hpp index cafc7cfb..07fc73f0 100644 --- a/include/bitcoin/database.hpp +++ b/include/bitcoin/database.hpp @@ -49,7 +49,9 @@ #include #include #include +#include #include +#include #include #include #include diff --git a/include/bitcoin/database/store.hpp b/include/bitcoin/database/store.hpp index bdb5d0c8..e3f11c83 100644 --- a/include/bitcoin/database/store.hpp +++ b/include/bitcoin/database/store.hpp @@ -16,8 +16,8 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef LIBBITCOIN_DATABASE_TABLES_STORE_HPP -#define LIBBITCOIN_DATABASE_TABLES_STORE_HPP +#ifndef LIBBITCOIN_DATABASE_STORE_HPP +#define LIBBITCOIN_DATABASE_STORE_HPP #include #include @@ -27,93 +27,11 @@ #include #include #include -#include #include namespace libbitcoin { namespace database { -enum class event_t -{ - create_file, - open_file, - load_file, - unload_file, - close_file, - - create_table, - verify_table, - close_table, - - wait_lock, - flush_body, - backup_table, - copy_header, - archive_snapshot, - - restore_table, - recover_snapshot -}; - -enum class table_t -{ - store, - - header_table, - header_head, - header_body, - point_table, - point_head, - point_body, - input_table, - input_head, - input_body, - output_table, - output_head, - output_body, - puts_table, - puts_head, - puts_body, - tx_table, - tx_head, - txs_table, - tx_body, - txs_head, - txs_body, - - address_table, - address_head, - address_body, - candidate_table, - candidate_head, - candidate_body, - confirmed_table, - confirmed_head, - confirmed_body, - spend_table, - spend_head, - spend_body, - strong_tx_table, - strong_tx_head, - strong_tx_body, - - bootstrap_table, - bootstrap_head, - bootstrap_body, - buffer_table, - buffer_head, - buffer_body, - neutrino_table, - neutrino_head, - neutrino_body, - validated_bk_table, - validated_bk_head, - validated_bk_body, - validated_tx_table, - validated_tx_head, - validated_tx_body -}; - /// The store and query interface are the primary products of database. /// Store provides implmentation support for the public query interface. /// Query privides query interface implmentation over the store. @@ -297,4 +215,3 @@ class store #undef TEMPLATE #endif - diff --git a/include/bitcoin/database/tables/event.hpp b/include/bitcoin/database/tables/event.hpp new file mode 100644 index 00000000..13a110e2 --- /dev/null +++ b/include/bitcoin/database/tables/event.hpp @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2011-2023 libbitcoin developers (see AUTHORS) + * + * This file is part of libbitcoin. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +#ifndef LIBBITCOIN_DATABASE_TABLES_EVENT_HPP +#define LIBBITCOIN_DATABASE_TABLES_EVENT_HPP + +namespace libbitcoin { +namespace database { + +enum class event_t +{ + create_file, + open_file, + load_file, + unload_file, + close_file, + + create_table, + verify_table, + close_table, + + wait_lock, + flush_body, + backup_table, + copy_header, + archive_snapshot, + + restore_table, + recover_snapshot +}; + +} // namespace database +} // namespace libbitcoin + +#endif diff --git a/include/bitcoin/database/tables/table.hpp b/include/bitcoin/database/tables/table.hpp new file mode 100644 index 00000000..1ecd137b --- /dev/null +++ b/include/bitcoin/database/tables/table.hpp @@ -0,0 +1,87 @@ +/** + * Copyright (c) 2011-2023 libbitcoin developers (see AUTHORS) + * + * This file is part of libbitcoin. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +#ifndef LIBBITCOIN_DATABASE_TABLES_TABLE_HPP +#define LIBBITCOIN_DATABASE_TABLES_TABLE_HPP + +namespace libbitcoin { +namespace database { + +enum class table_t +{ + store, + + header_table, + header_head, + header_body, + point_table, + point_head, + point_body, + input_table, + input_head, + input_body, + output_table, + output_head, + output_body, + puts_table, + puts_head, + puts_body, + tx_table, + tx_head, + txs_table, + tx_body, + txs_head, + txs_body, + + address_table, + address_head, + address_body, + candidate_table, + candidate_head, + candidate_body, + confirmed_table, + confirmed_head, + confirmed_body, + spend_table, + spend_head, + spend_body, + strong_tx_table, + strong_tx_head, + strong_tx_body, + + bootstrap_table, + bootstrap_head, + bootstrap_body, + buffer_table, + buffer_head, + buffer_body, + neutrino_table, + neutrino_head, + neutrino_body, + validated_bk_table, + validated_bk_head, + validated_bk_body, + validated_tx_table, + validated_tx_head, + validated_tx_body +}; + +} // namespace database +} // namespace libbitcoin + +#endif diff --git a/include/bitcoin/database/tables/tables.hpp b/include/bitcoin/database/tables/tables.hpp index e9c6e197..80652098 100644 --- a/include/bitcoin/database/tables/tables.hpp +++ b/include/bitcoin/database/tables/tables.hpp @@ -39,6 +39,8 @@ #include #include +#include #include +#include #endif