Skip to content

Commit

Permalink
db: move db to the root level (#1894)
Browse files Browse the repository at this point in the history
  • Loading branch information
battlmonstr authored Mar 11, 2024
1 parent aea61c2 commit 13d0b98
Show file tree
Hide file tree
Showing 281 changed files with 375 additions and 372 deletions.
2 changes: 1 addition & 1 deletion cmake/copyright.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ list(FILTER SRC EXCLUDE REGEX [[silkworm/core/crypto/kzg\.cpp$]])
list(FILTER SRC EXCLUDE REGEX [[silkworm/infra/concurrency/thread_pool\.hpp$]])
list(FILTER SRC EXCLUDE REGEX [[silkworm/interfaces/]])
list(FILTER SRC EXCLUDE REGEX [[silkworm/node/common/preverified_hashes_[a-z]+\.cpp$]])
list(FILTER SRC EXCLUDE REGEX [[silkworm/snapshots/config/[a-z_]+\.hpp$]])
list(FILTER SRC EXCLUDE REGEX [[silkworm/db/snapshots/config/[a-z_]+\.hpp$]])

foreach(F IN LISTS SRC)
check("${F}")
Expand Down
6 changes: 3 additions & 3 deletions cmd/capi/execute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
#pragma GCC diagnostic pop

#include <silkworm/capi/silkworm.h>
#include <silkworm/db/access_layer.hpp>
#include <silkworm/db/mdbx.hpp>
#include <silkworm/db/snapshots/repository.hpp>
#include <silkworm/infra/common/directories.hpp>
#include <silkworm/infra/common/log.hpp>
#include <silkworm/node/db/access_layer.hpp>
#include <silkworm/node/db/mdbx.hpp>
#include <silkworm/rpc/daemon.hpp>
#include <silkworm/snapshots/repository.hpp>

#include "../common/common.hpp"

Expand Down
6 changes: 3 additions & 3 deletions cmd/common/db_checklist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
#include <regex>

#include <silkworm/core/chain/genesis.hpp>
#include <silkworm/db/access_layer.hpp>
#include <silkworm/db/genesis.hpp>
#include <silkworm/db/stages.hpp>
#include <silkworm/infra/common/log.hpp>
#include <silkworm/node/db/access_layer.hpp>
#include <silkworm/node/db/genesis.hpp>
#include <silkworm/node/db/stages.hpp>

namespace silkworm::cmd::common {

Expand Down
2 changes: 1 addition & 1 deletion cmd/common/db_max_readers_option.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "db_max_readers_option.hpp"

#include <silkworm/node/db/mdbx.hpp>
#include <silkworm/db/mdbx.hpp>

namespace silkworm::cmd::common {

Expand Down
2 changes: 1 addition & 1 deletion cmd/common/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

#pragma once

#include <silkworm/db/snapshots/settings.hpp>
#include <silkworm/infra/common/log.hpp>
#include <silkworm/node/settings.hpp>
#include <silkworm/rpc/settings.hpp>
#include <silkworm/sentry/settings.hpp>
#include <silkworm/snapshots/settings.hpp>

namespace silkworm::cmd::common {

Expand Down
2 changes: 1 addition & 1 deletion cmd/common/snapshot_options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include <CLI/CLI.hpp>

#include <silkworm/snapshots/settings.hpp>
#include <silkworm/db/snapshots/settings.hpp>

namespace silkworm::cmd::common {

Expand Down
6 changes: 3 additions & 3 deletions cmd/dev/backend_kv_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
#include <silkworm/buildinfo.h>
#include <silkworm/core/types/address.hpp>
#include <silkworm/core/types/evmc_bytes32.hpp>
#include <silkworm/db/access_layer.hpp>
#include <silkworm/db/head_info.hpp>
#include <silkworm/db/mdbx.hpp>
#include <silkworm/infra/common/directories.hpp>
#include <silkworm/infra/common/log.hpp>
#include <silkworm/infra/concurrency/awaitable_wait_for_one.hpp>
#include <silkworm/infra/grpc/client/client_context_pool.hpp>
#include <silkworm/node/backend/ethereum_backend.hpp>
#include <silkworm/node/backend/remote/backend_kv_server.hpp>
#include <silkworm/node/db/access_layer.hpp>
#include <silkworm/node/db/head_info.hpp>
#include <silkworm/node/db/mdbx.hpp>
#include <silkworm/sentry/eth/status_data_provider.hpp>
#include <silkworm/sentry/grpc/client/sentry_client.hpp>
#include <silkworm/sentry/multi_sentry_client.hpp>
Expand Down
2 changes: 1 addition & 1 deletion cmd/dev/check_blockhashes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
#include <CLI/CLI.hpp>

#include <silkworm/core/common/endian.hpp>
#include <silkworm/db/tables.hpp>
#include <silkworm/infra/common/directories.hpp>
#include <silkworm/infra/common/log.hpp>
#include <silkworm/infra/common/stopwatch.hpp>
#include <silkworm/node/db/tables.hpp>

using namespace silkworm;

Expand Down
6 changes: 3 additions & 3 deletions cmd/dev/check_changes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
#include <silkworm/core/execution/processor.hpp>
#include <silkworm/core/types/address.hpp>
#include <silkworm/core/types/evmc_bytes32.hpp>
#include <silkworm/db/access_layer.hpp>
#include <silkworm/db/buffer.hpp>
#include <silkworm/db/snapshots/repository.hpp>
#include <silkworm/infra/common/directories.hpp>
#include <silkworm/infra/common/log.hpp>
#include <silkworm/infra/concurrency/signal_handler.hpp>
#include <silkworm/node/db/access_layer.hpp>
#include <silkworm/node/db/buffer.hpp>
#include <silkworm/snapshots/repository.hpp>

using namespace evmc::literals;
using namespace silkworm;
Expand Down
4 changes: 2 additions & 2 deletions cmd/dev/check_hashstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

#include <CLI/CLI.hpp>

#include <silkworm/db/tables.hpp>
#include <silkworm/db/util.hpp>
#include <silkworm/infra/common/directories.hpp>
#include <silkworm/infra/common/log.hpp>
#include <silkworm/node/db/tables.hpp>
#include <silkworm/node/db/util.hpp>

using namespace silkworm;

Expand Down
10 changes: 5 additions & 5 deletions cmd/dev/check_log_indices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
#include <silkworm/core/common/bytes_to_string.hpp>
#include <silkworm/core/types/address.hpp>
#include <silkworm/core/types/evmc_bytes32.hpp>
#include <silkworm/db/bitmap.hpp>
#include <silkworm/db/log_cbor.hpp>
#include <silkworm/db/mdbx.hpp>
#include <silkworm/db/tables.hpp>
#include <silkworm/db/util.hpp>
#include <silkworm/infra/common/directories.hpp>
#include <silkworm/infra/common/ensure.hpp>
#include <silkworm/infra/common/log.hpp>
#include <silkworm/infra/concurrency/signal_handler.hpp>
#include <silkworm/node/db/bitmap.hpp>
#include <silkworm/node/db/log_cbor.hpp>
#include <silkworm/node/db/mdbx.hpp>
#include <silkworm/node/db/tables.hpp>
#include <silkworm/node/db/util.hpp>

#include "../common/common.hpp"

Expand Down
4 changes: 2 additions & 2 deletions cmd/dev/check_pow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
#include <silkworm/core/chain/config.hpp>
#include <silkworm/core/common/endian.hpp>
#include <silkworm/core/types/evmc_bytes32.hpp>
#include <silkworm/db/access_layer.hpp>
#include <silkworm/db/stages.hpp>
#include <silkworm/infra/common/directories.hpp>
#include <silkworm/infra/common/log.hpp>
#include <silkworm/infra/common/stopwatch.hpp>
#include <silkworm/infra/concurrency/signal_handler.hpp>
#include <silkworm/node/db/access_layer.hpp>
#include <silkworm/node/db/stages.hpp>

namespace fs = std::filesystem;
using namespace silkworm;
Expand Down
2 changes: 1 addition & 1 deletion cmd/dev/check_senders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
#include <silkworm/core/types/address.hpp>
#include <silkworm/core/types/block_body_for_storage.hpp>
#include <silkworm/core/types/evmc_bytes32.hpp>
#include <silkworm/db/stages.hpp>
#include <silkworm/infra/common/decoding_exception.hpp>
#include <silkworm/infra/common/directories.hpp>
#include <silkworm/infra/common/log.hpp>
#include <silkworm/infra/concurrency/signal_handler.hpp>
#include <silkworm/node/db/stages.hpp>

#include "../common/common.hpp"

Expand Down
4 changes: 2 additions & 2 deletions cmd/dev/check_tx_lookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
#include <silkworm/core/common/endian.hpp>
#include <silkworm/core/common/util.hpp>
#include <silkworm/core/types/block_body_for_storage.hpp>
#include <silkworm/db/etl/collector.hpp>
#include <silkworm/db/stages.hpp>
#include <silkworm/infra/common/decoding_exception.hpp>
#include <silkworm/infra/common/directories.hpp>
#include <silkworm/infra/common/log.hpp>
#include <silkworm/infra/concurrency/signal_handler.hpp>
#include <silkworm/node/db/etl/collector.hpp>
#include <silkworm/node/db/stages.hpp>

using namespace silkworm;

Expand Down
8 changes: 4 additions & 4 deletions cmd/dev/db_toolbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@
#include <silkworm/core/types/address.hpp>
#include <silkworm/core/types/block_body_for_storage.hpp>
#include <silkworm/core/types/evmc_bytes32.hpp>
#include <silkworm/db/genesis.hpp>
#include <silkworm/db/mdbx.hpp>
#include <silkworm/db/prune_mode.hpp>
#include <silkworm/db/stages.hpp>
#include <silkworm/infra/common/decoding_exception.hpp>
#include <silkworm/infra/common/directories.hpp>
#include <silkworm/infra/common/ensure.hpp>
#include <silkworm/infra/common/log.hpp>
#include <silkworm/infra/common/stopwatch.hpp>
#include <silkworm/infra/concurrency/signal_handler.hpp>
#include <silkworm/node/db/genesis.hpp>
#include <silkworm/node/db/mdbx.hpp>
#include <silkworm/node/db/prune_mode.hpp>
#include <silkworm/node/db/stages.hpp>
#include <silkworm/node/stagedsync/execution_pipeline.hpp>
#include <silkworm/node/stagedsync/stages/stage_interhashes/trie_cursor.hpp>

Expand Down
2 changes: 1 addition & 1 deletion cmd/dev/embed_toml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ int main(int argc, char* argv[]) {
output << "#pragma once\n\n";
output << "#include <array>\n";
output << "#include <string_view>\n\n";
output << "#include <silkworm/snapshots/entry.hpp>\n\n";
output << "#include <silkworm/db/snapshots/entry.hpp>\n\n";
output << "namespace silkworm::snapshots {\n\n";
output << "inline constexpr std::array k" << snapshot_name << "Snapshots{\n";
for (auto&& [key, value] : table) {
Expand Down
4 changes: 2 additions & 2 deletions cmd/dev/scan_txs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

#include <silkworm/core/execution/execution.hpp>
#include <silkworm/core/protocol/rule_set.hpp>
#include <silkworm/db/access_layer.hpp>
#include <silkworm/db/buffer.hpp>
#include <silkworm/infra/common/directories.hpp>
#include <silkworm/node/db/access_layer.hpp>
#include <silkworm/node/db/buffer.hpp>

int main(int argc, char* argv[]) {
CLI::App app{"Executes Ethereum blocks and scans txs for errored txs"};
Expand Down
12 changes: 6 additions & 6 deletions cmd/dev/snapshots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
#include <silkworm/core/types/address.hpp>
#include <silkworm/core/types/block_body_for_storage.hpp>
#include <silkworm/core/types/evmc_bytes32.hpp>
#include <silkworm/db/snapshot_sync.hpp>
#include <silkworm/db/snapshots/bittorrent/client.hpp>
#include <silkworm/db/snapshots/index.hpp>
#include <silkworm/db/snapshots/repository.hpp>
#include <silkworm/db/snapshots/seg/seg_zip.hpp>
#include <silkworm/db/snapshots/snapshot.hpp>
#include <silkworm/infra/common/ensure.hpp>
#include <silkworm/infra/common/log.hpp>
#include <silkworm/node/snapshot_sync.hpp>
#include <silkworm/snapshots/bittorrent/client.hpp>
#include <silkworm/snapshots/index.hpp>
#include <silkworm/snapshots/repository.hpp>
#include <silkworm/snapshots/seg/seg_zip.hpp>
#include <silkworm/snapshots/snapshot.hpp>

#include "../common/common.hpp"
#include "../common/shutdown_signal.hpp"
Expand Down
2 changes: 1 addition & 1 deletion cmd/silkworm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
#include <boost/asio/use_future.hpp>

#include <silkworm/buildinfo.h>
#include <silkworm/db/head_info.hpp>
#include <silkworm/infra/common/log.hpp>
#include <silkworm/infra/concurrency/awaitable_wait_for_all.hpp>
#include <silkworm/infra/concurrency/awaitable_wait_for_one.hpp>
#include <silkworm/infra/grpc/client/client_context_pool.hpp>
#include <silkworm/node/db/head_info.hpp>
#include <silkworm/node/node.hpp>
#include <silkworm/sentry/eth/status_data_provider.hpp>
#include <silkworm/sentry/sentry_client_factory.hpp>
Expand Down
2 changes: 1 addition & 1 deletion cmd/test/backend_kv_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
#include <silkworm/core/common/assert.hpp>
#include <silkworm/core/common/util.hpp>
#include <silkworm/core/types/address.hpp>
#include <silkworm/db/tables.hpp>
#include <silkworm/infra/common/log.hpp>
#include <silkworm/infra/grpc/common/conversion.hpp>
#include <silkworm/infra/grpc/common/util.hpp>
#include <silkworm/interfaces/remote/ethbackend.grpc.pb.h>
#include <silkworm/interfaces/remote/kv.grpc.pb.h>
#include <silkworm/node/db/tables.hpp>

#include "../common/shutdown_signal.hpp"

Expand Down
2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ If you need to update the list of builtin snapshots in Silkworm, the following p
* update `erigon-snapshot` submodule to the new commit
* generate the embedded C++ code bindings for predefined snapshots by executing from project home folder:
```
<build_folder>/cmd/dev/embed_toml -i third_party/erigon-snapshot -o silkworm/snapshots/config
<build_folder>/cmd/dev/embed_toml -i third_party/erigon-snapshot -o silkworm/db/snapshots/config
```


Expand Down
4 changes: 2 additions & 2 deletions silkworm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ add_subdirectory(core)
if(NOT SILKWORM_CORE_ONLY)
add_subdirectory(interfaces)
add_subdirectory(infra)
add_subdirectory(db)
add_subdirectory(rpc)
add_subdirectory(sentry)
add_subdirectory(snapshots)
add_subdirectory(sync)
add_subdirectory(node)
add_subdirectory(rpc)
add_subdirectory(capi)
endif()

Expand Down
2 changes: 1 addition & 1 deletion silkworm/capi/instance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

#include <boost/asio/cancellation_signal.hpp>

#include <silkworm/db/snapshots/repository.hpp>
#include <silkworm/infra/concurrency/context_pool_settings.hpp>
#include <silkworm/rpc/daemon.hpp>
#include <silkworm/snapshots/repository.hpp>

struct SilkwormInstance {
silkworm::concurrency::ContextPoolSettings context_pool_settings;
Expand Down
8 changes: 4 additions & 4 deletions silkworm/capi/silkworm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@
#include <silkworm/core/chain/config.hpp>
#include <silkworm/core/execution/call_tracer.hpp>
#include <silkworm/core/execution/execution.hpp>
#include <silkworm/db/access_layer.hpp>
#include <silkworm/db/buffer.hpp>
#include <silkworm/db/snapshots/index.hpp>
#include <silkworm/db/stages.hpp>
#include <silkworm/infra/common/bounded_buffer.hpp>
#include <silkworm/infra/common/directories.hpp>
#include <silkworm/infra/common/log.hpp>
#include <silkworm/infra/common/stopwatch.hpp>
#include <silkworm/infra/concurrency/signal_handler.hpp>
#include <silkworm/infra/concurrency/thread_pool.hpp>
#include <silkworm/node/db/access_layer.hpp>
#include <silkworm/node/db/buffer.hpp>
#include <silkworm/node/db/stages.hpp>
#include <silkworm/snapshots/index.hpp>

#include "instance.hpp"

Expand Down
8 changes: 4 additions & 4 deletions silkworm/capi/silkworm_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
#include <catch2/catch.hpp>

#include <silkworm/core/trie/vector_root.hpp>
#include <silkworm/db/mdbx.hpp>
#include <silkworm/db/snapshots/index.hpp>
#include <silkworm/db/snapshots/snapshot.hpp>
#include <silkworm/db/snapshots/test_util/common.hpp>
#include <silkworm/infra/test_util/log.hpp>
#include <silkworm/node/db/mdbx.hpp>
#include <silkworm/rpc/test/api_test_database.hpp>
#include <silkworm/snapshots/index.hpp>
#include <silkworm/snapshots/snapshot.hpp>
#include <silkworm/snapshots/test_util/common.hpp>

namespace silkworm {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
include("${SILKWORM_MAIN_DIR}/cmake/common/targets.cmake")

add_subdirectory(etl)
add_subdirectory(snapshots)

find_package(absl REQUIRED)
find_package(magic_enum REQUIRED)
find_package(Microsoft.GSL REQUIRED)
find_package(nlohmann_json REQUIRED)
find_package(roaring REQUIRED)
Expand All @@ -36,8 +38,10 @@ set(LIBS_PUBLIC
# cmake-format: off
set(LIBS_PRIVATE
cborcpp
magic_enum::magic_enum
Microsoft.GSL::GSL
nlohmann_json::nlohmann_json
silkworm_db_etl
silkworm_infra
silkworm_snapshots
)
Expand All @@ -47,5 +51,5 @@ silkworm_library(
silkworm_db
PUBLIC ${LIBS_PUBLIC}
PRIVATE ${LIBS_PRIVATE}
EXCLUDE_REGEX "node/db/etl"
EXCLUDE_REGEX "db/etl" "db/snapshots"
)
Loading

0 comments on commit 13d0b98

Please sign in to comment.