Skip to content

Commit

Permalink
Style: factor enums to own files.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed May 1, 2024
1 parent 4b672db commit c69b7f8
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 85 deletions.
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,13 @@
<ClInclude Include="..\..\..\..\include\bitcoin\database\tables\caches\validated_bk.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\database\tables\caches\validated_tx.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\database\tables\context.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\database\tables\event.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\database\tables\indexes\address.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\database\tables\indexes\height.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\database\tables\indexes\spend.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\database\tables\indexes\strong_tx.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\database\tables\schema.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\database\tables\table.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\database\tables\tables.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\database\version.hpp" />
<ClInclude Include="..\..\..\..\src\memory\mman-win32\mman.h" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@
<ClInclude Include="..\..\..\..\include\bitcoin\database\tables\context.hpp">
<Filter>include\bitcoin\database\tables</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\database\tables\event.hpp">
<Filter>include\bitcoin\database\tables</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\database\tables\indexes\address.hpp">
<Filter>include\bitcoin\database\tables\indexes</Filter>
</ClInclude>
Expand All @@ -257,6 +260,9 @@
<ClInclude Include="..\..\..\..\include\bitcoin\database\tables\schema.hpp">
<Filter>include\bitcoin\database\tables</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\database\tables\table.hpp">
<Filter>include\bitcoin\database\tables</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\database\tables\tables.hpp">
<Filter>include\bitcoin\database\tables</Filter>
</ClInclude>
Expand Down
2 changes: 2 additions & 0 deletions include/bitcoin/database.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
#include <bitcoin/database/primitives/manager.hpp>
#include <bitcoin/database/primitives/primitives.hpp>
#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/archives/header.hpp>
#include <bitcoin/database/tables/archives/input.hpp>
Expand Down
87 changes: 2 additions & 85 deletions include/bitcoin/database/store.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBBITCOIN_DATABASE_TABLES_STORE_HPP
#define LIBBITCOIN_DATABASE_TABLES_STORE_HPP
#ifndef LIBBITCOIN_DATABASE_STORE_HPP
#define LIBBITCOIN_DATABASE_STORE_HPP

#include <filesystem>
#include <functional>
Expand All @@ -27,93 +27,11 @@
#include <bitcoin/database/settings.hpp>
#include <bitcoin/database/locks/locks.hpp>
#include <bitcoin/database/memory/memory.hpp>
#include <bitcoin/database/tables/schema.hpp>
#include <bitcoin/database/tables/tables.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
};

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.
Expand Down Expand Up @@ -297,4 +215,3 @@ class store
#undef TEMPLATE

#endif

50 changes: 50 additions & 0 deletions include/bitcoin/database/tables/event.hpp
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/
#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
87 changes: 87 additions & 0 deletions include/bitcoin/database/tables/table.hpp
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/
#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
2 changes: 2 additions & 0 deletions include/bitcoin/database/tables/tables.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
#include <bitcoin/database/tables/indexes/strong_tx.hpp>

#include <bitcoin/database/tables/context.hpp>
#include <bitcoin/database/tables/event.hpp>
#include <bitcoin/database/tables/schema.hpp>
#include <bitcoin/database/tables/table.hpp>

#endif

0 comments on commit c69b7f8

Please sign in to comment.