Skip to content

Commit

Permalink
datastore library
Browse files Browse the repository at this point in the history
  • Loading branch information
battlmonstr committed Oct 10, 2024
1 parent 152eeb3 commit 44bb8cb
Show file tree
Hide file tree
Showing 21 changed files with 71 additions and 31 deletions.
2 changes: 1 addition & 1 deletion cmd/dev/db_toolbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
#include <silkworm/db/datastore/mdbx/mdbx.hpp>
#include <silkworm/db/datastore/snapshots/snapshot_repository.hpp>
#include <silkworm/db/datastore/snapshots/snapshot_settings.hpp>
#include <silkworm/db/datastore/stage_scheduler.hpp>
#include <silkworm/db/freezer.hpp>
#include <silkworm/db/genesis.hpp>
#include <silkworm/db/prune_mode.hpp>
#include <silkworm/db/snapshot_bundle_factory_impl.hpp>
#include <silkworm/db/stage_scheduler.hpp>
#include <silkworm/db/stages.hpp>
#include <silkworm/infra/common/decoding_exception.hpp>
#include <silkworm/infra/common/directories.hpp>
Expand Down
2 changes: 1 addition & 1 deletion cmd/dev/snapshots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <silkworm/db/blocks/bodies/body_queries.hpp>
#include <silkworm/db/blocks/headers/header_index.hpp>
#include <silkworm/db/blocks/headers/header_queries.hpp>
#include <silkworm/db/datastore/snapshot_merger.hpp>
#include <silkworm/db/datastore/snapshots/bittorrent/client.hpp>
#include <silkworm/db/datastore/snapshots/bittorrent/web_seed_client.hpp>
#include <silkworm/db/datastore/snapshots/index/btree_index.hpp>
Expand All @@ -48,7 +49,6 @@
#include <silkworm/db/datastore/snapshots/snapshot_reader.hpp>
#include <silkworm/db/datastore/snapshots/snapshot_repository.hpp>
#include <silkworm/db/snapshot_bundle_factory_impl.hpp>
#include <silkworm/db/snapshot_merger.hpp>
#include <silkworm/db/snapshot_recompress.hpp>
#include <silkworm/db/snapshot_sync.hpp>
#include <silkworm/db/tables.hpp>
Expand Down
11 changes: 3 additions & 8 deletions silkworm/db/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

include("${SILKWORM_MAIN_DIR}/cmake/common/targets.cmake")

add_subdirectory(datastore/etl)
add_subdirectory(datastore/mdbx)
add_subdirectory(datastore/snapshots)
add_subdirectory(datastore)
add_subdirectory(test_util)

find_package(absl REQUIRED)
Expand All @@ -36,10 +34,10 @@ set(LIBS_PUBLIC
absl::flat_hash_set
absl::strings
silkworm_core
silkworm_db_mdbx
silkworm_infra
silkworm_datastore
)

# cmake-format: off
set(LIBS_PRIVATE
cborcpp
magic_enum::magic_enum
Expand All @@ -50,10 +48,7 @@ set(LIBS_PRIVATE
gRPC::grpc++
protobuf::libprotobuf
silkworm_db_etl
silkworm_infra
silkworm_snapshots
)
# cmake-format: on

silkworm_library(
silkworm_db
Expand Down
2 changes: 1 addition & 1 deletion silkworm/db/blocks/bodies/body_snapshot_freezer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#pragma once

#include <silkworm/db/snapshot_freezer.hpp>
#include <silkworm/db/datastore/snapshot_freezer.hpp>

namespace silkworm::db {

Expand Down
2 changes: 1 addition & 1 deletion silkworm/db/blocks/headers/header_snapshot_freezer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#pragma once

#include <silkworm/db/snapshot_freezer.hpp>
#include <silkworm/db/datastore/snapshot_freezer.hpp>

namespace silkworm::db {

Expand Down
44 changes: 44 additions & 0 deletions silkworm/db/datastore/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#[[
Copyright 2024 The Silkworm Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
]]

include("${SILKWORM_MAIN_DIR}/cmake/common/targets.cmake")

add_subdirectory(etl)
add_subdirectory(mdbx)
add_subdirectory(snapshots)

find_package(Boost REQUIRED headers)

# cmake-format: off
set(LIBS_PUBLIC
Boost::headers
silkworm_core
silkworm_infra
silkworm_db_mdbx
silkworm_snapshots
)
# cmake-format: on

# cmake-format: off
set(LIBS_PRIVATE
)
# cmake-format: on

silkworm_library(
silkworm_datastore
PUBLIC ${LIBS_PUBLIC}
PRIVATE ${LIBS_PRIVATE}
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#include <silkworm/core/common/base.hpp>

#include "data_migration_command.hpp"
#include "datastore/mdbx/mdbx.hpp"
#include "datastore/snapshots/snapshot_writer.hpp"
#include "mdbx/mdbx.hpp"
#include "snapshots/snapshot_writer.hpp"

namespace silkworm::db {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
#include <silkworm/infra/common/filesystem.hpp>
#include <silkworm/infra/common/log.hpp>

#include "datastore/snapshots/seg/compressor.hpp"
#include "datastore/snapshots/snapshot_bundle.hpp"
#include "datastore/snapshots/snapshot_path.hpp"
#include "datastore/snapshots/snapshot_writer.hpp"
#include "snapshots/seg/compressor.hpp"
#include "snapshots/snapshot_bundle.hpp"
#include "snapshots/snapshot_path.hpp"
#include "snapshots/snapshot_writer.hpp"

namespace silkworm::db {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include <silkworm/core/common/base.hpp>

#include "data_migration.hpp"
#include "datastore/snapshots/snapshot_repository.hpp"
#include "datastore/snapshots/snapshot_size.hpp"
#include "snapshots/snapshot_repository.hpp"
#include "snapshots/snapshot_size.hpp"

namespace silkworm::db {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <silkworm/infra/concurrency/task.hpp>

#include <silkworm/db/datastore/mdbx/mdbx.hpp>
#include "mdbx/mdbx.hpp"

namespace silkworm::stagedsync {

Expand Down
2 changes: 1 addition & 1 deletion silkworm/db/freezer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
#include "access_layer.hpp"
#include "blocks/bodies/body_snapshot_freezer.hpp"
#include "blocks/headers/header_snapshot_freezer.hpp"
#include "datastore/snapshot_freezer.hpp"
#include "datastore/snapshots/snapshot_bundle.hpp"
#include "datastore/snapshots/snapshot_path.hpp"
#include "datastore/snapshots/snapshot_writer.hpp"
#include "prune_mode.hpp"
#include "snapshot_freezer.hpp"
#include "transactions/txn_snapshot_freezer.hpp"

namespace silkworm::db {
Expand Down
4 changes: 2 additions & 2 deletions silkworm/db/freezer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

#pragma once

#include "data_migration.hpp"
#include "datastore/data_migration.hpp"
#include "datastore/mdbx/mdbx.hpp"
#include "datastore/snapshots/snapshot_repository.hpp"
#include "stage_scheduler.hpp"
#include "datastore/stage_scheduler.hpp"

namespace silkworm::db {

Expand Down
5 changes: 3 additions & 2 deletions silkworm/db/snapshot_sync.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@
#include <silkworm/db/datastore/snapshots/snapshot_repository.hpp>
#include <silkworm/db/datastore/snapshots/snapshot_settings.hpp>
#include <silkworm/db/freezer.hpp>
#include <silkworm/db/snapshot_merger.hpp>
#include <silkworm/db/stage_scheduler.hpp>
#include <silkworm/infra/concurrency/awaitable_condition_variable.hpp>
#include <silkworm/infra/concurrency/stoppable.hpp>

#include "datastore/snapshot_merger.hpp"
#include "datastore/stage_scheduler.hpp"

namespace silkworm::db {

class SnapshotSync {
Expand Down
2 changes: 1 addition & 1 deletion silkworm/db/transactions/txn_snapshot_freezer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#pragma once

#include <silkworm/db/snapshot_freezer.hpp>
#include <silkworm/db/datastore/snapshot_freezer.hpp>

namespace silkworm::db {

Expand Down
2 changes: 1 addition & 1 deletion silkworm/node/stagedsync/execution_engine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

#include <silkworm/core/common/lru_cache.hpp>
#include <silkworm/core/types/block.hpp>
#include <silkworm/db/datastore/stage_scheduler.hpp>
#include <silkworm/db/stage.hpp>
#include <silkworm/db/stage_scheduler.hpp>
#include <silkworm/execution/api/execution_engine.hpp>
#include <silkworm/infra/concurrency/context_pool.hpp>
#include <silkworm/node/stagedsync/execution_pipeline.hpp>
Expand Down
2 changes: 1 addition & 1 deletion silkworm/node/stagedsync/execution_pipeline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#include <boost/asio/any_io_executor.hpp>

#include <silkworm/core/types/hash.hpp>
#include <silkworm/db/datastore/stage_scheduler.hpp>
#include <silkworm/db/stage.hpp>
#include <silkworm/db/stage_scheduler.hpp>
#include <silkworm/infra/common/timer.hpp>
#include <silkworm/node/common/node_settings.hpp>

Expand Down
2 changes: 1 addition & 1 deletion silkworm/node/stagedsync/forks/main_chain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#include <silkworm/core/common/lru_cache.hpp>
#include <silkworm/core/types/block.hpp>
#include <silkworm/db/datastore/mdbx/memory_mutation.hpp>
#include <silkworm/db/datastore/stage_scheduler.hpp>
#include <silkworm/db/stage.hpp>
#include <silkworm/db/stage_scheduler.hpp>
#include <silkworm/execution/api/endpoint/validation.hpp>
#include <silkworm/node/stagedsync/execution_pipeline.hpp>

Expand Down
2 changes: 1 addition & 1 deletion silkworm/node/stagedsync/stages/stage_triggers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

#include <boost/asio/io_context.hpp>

#include <silkworm/db/datastore/stage_scheduler.hpp>
#include <silkworm/db/stage.hpp>
#include <silkworm/db/stage_scheduler.hpp>

namespace silkworm::stagedsync {

Expand Down

0 comments on commit 44bb8cb

Please sign in to comment.