chore(db): move mod tables to db-api (#14540)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
DaniPopes
2025-02-17 21:53:39 +01:00
committed by GitHub
parent 336c3d1fac
commit 482f4557eb
106 changed files with 269 additions and 274 deletions

View File

@ -5,8 +5,11 @@ use crate::{
use ahash::RandomState;
use clap::Parser;
use reth_chainspec::EthereumHardforks;
use reth_db::{DatabaseEnv, RawKey, RawTable, RawValue, TableViewer, Tables};
use reth_db_api::{cursor::DbCursorRO, table::Table, transaction::DbTx};
use reth_db::DatabaseEnv;
use reth_db_api::{
cursor::DbCursorRO, table::Table, transaction::DbTx, RawKey, RawTable, RawValue, TableViewer,
Tables,
};
use reth_db_common::DbTool;
use reth_node_builder::{NodeTypesWithDB, NodeTypesWithDBAdapter};
use reth_provider::{providers::ProviderNodeTypes, DBProvider};

View File

@ -1,9 +1,10 @@
use clap::{Parser, Subcommand};
use reth_db::{static_file::iter_static_files, TableViewer, Tables};
use reth_db::static_file::iter_static_files;
use reth_db_api::{
database::Database,
table::Table,
transaction::{DbTx, DbTxMut},
TableViewer, Tables,
};
use reth_node_builder::NodeTypesWithDB;
use reth_provider::{ProviderFactory, StaticFileProviderFactory};

View File

@ -1,6 +1,8 @@
use clap::Parser;
use reth_db::{open_db_read_only, tables_to_generic, DatabaseEnv, Tables};
use reth_db_api::{cursor::DbCursorRO, database::Database, table::Table, transaction::DbTx};
use reth_db::{open_db_read_only, tables_to_generic, DatabaseEnv};
use reth_db_api::{
cursor::DbCursorRO, database::Database, table::Table, transaction::DbTx, Tables,
};
use reth_db_common::DbTool;
use reth_node_builder::{NodeTypesWithDBAdapter, NodeTypesWithEngine};
use reth_node_core::{

View File

@ -1,13 +1,13 @@
use alloy_consensus::Header;
use alloy_primitives::{hex, BlockHash};
use clap::Parser;
use reth_db::{
static_file::{
ColumnSelectorOne, ColumnSelectorTwo, HeaderWithHashMask, ReceiptMask, TransactionMask,
},
use reth_db::static_file::{
ColumnSelectorOne, ColumnSelectorTwo, HeaderWithHashMask, ReceiptMask, TransactionMask,
};
use reth_db_api::{
table::{Decompress, DupSort, Table},
tables, RawKey, RawTable, Receipts, TableViewer, Transactions,
};
use reth_db_api::table::{Decompress, DupSort, Table};
use reth_db_common::DbTool;
use reth_node_api::{ReceiptTy, TxTy};
use reth_node_builder::NodeTypesWithDB;
@ -207,8 +207,10 @@ mod tests {
use super::*;
use alloy_primitives::{Address, B256};
use clap::{Args, Parser};
use reth_db::{AccountsHistory, HashedAccounts, Headers, StageCheckpoints, StoragesHistory};
use reth_db_api::models::{storage_sharded_key::StorageShardedKey, ShardedKey};
use reth_db_api::{
models::{storage_sharded_key::StorageShardedKey, ShardedKey},
AccountsHistory, HashedAccounts, Headers, StageCheckpoints, StoragesHistory,
};
use std::str::FromStr;
/// A helper type to parse Args more easily

View File

@ -3,8 +3,8 @@ use alloy_primitives::hex;
use clap::Parser;
use eyre::WrapErr;
use reth_chainspec::EthereumHardforks;
use reth_db::{DatabaseEnv, RawValue, TableViewer, Tables};
use reth_db_api::{database::Database, table::Table};
use reth_db::DatabaseEnv;
use reth_db_api::{database::Database, table::Table, RawValue, TableViewer, Tables};
use reth_db_common::{DbTool, ListFilter};
use reth_node_builder::{NodeTypesWithDBAdapter, NodeTypesWithEngine};
use std::{cell::RefCell, sync::Arc};

View File

@ -5,8 +5,8 @@ use eyre::WrapErr;
use human_bytes::human_bytes;
use itertools::Itertools;
use reth_chainspec::EthereumHardforks;
use reth_db::{mdbx, static_file::iter_static_files, DatabaseEnv, TableViewer, Tables};
use reth_db_api::database::Database;
use reth_db::{mdbx, static_file::iter_static_files, DatabaseEnv};
use reth_db_api::{database::Database, TableViewer, Tables};
use reth_db_common::DbTool;
use reth_fs_util as fs;
use reth_node_builder::{NodePrimitives, NodeTypesWithDB, NodeTypesWithDBAdapter};

View File

@ -10,8 +10,10 @@ use ratatui::{
widgets::{Block, Borders, List, ListItem, ListState, Paragraph, Wrap},
Frame, Terminal,
};
use reth_db::RawValue;
use reth_db_api::table::{Table, TableRow};
use reth_db_api::{
table::{Table, TableRow},
RawValue,
};
use std::{
io,
time::{Duration, Instant},

View File

@ -7,8 +7,7 @@ use reth_chainspec::{EthChainSpec, EthereumHardforks};
use reth_cli::chainspec::ChainSpecParser;
use reth_config::Config;
use reth_consensus::{ConsensusError, FullConsensus};
use reth_db::tables;
use reth_db_api::transaction::DbTx;
use reth_db_api::{tables, transaction::DbTx};
use reth_downloaders::{
bodies::bodies::BodiesDownloaderBuilder,
file_client::{ChunkedFileReader, FileClient, DEFAULT_BYTE_LEN_CHUNK_CHAIN_FILE},

View File

@ -4,9 +4,9 @@ use clap::Parser;
use reth_chainspec::{EthChainSpec, EthereumHardforks};
use reth_cli::chainspec::ChainSpecParser;
use reth_cli_runner::CliContext;
use reth_db::tables;
use reth_db_api::{
cursor::{DbCursorRO, DbDupCursorRW},
tables,
transaction::DbTx,
};
use reth_provider::{BlockNumReader, HeaderProvider, ProviderError};

View File

@ -4,8 +4,11 @@ use clap::Parser;
use itertools::Itertools;
use reth_chainspec::EthChainSpec;
use reth_cli::chainspec::ChainSpecParser;
use reth_db::{mdbx::tx::Tx, static_file::iter_static_files, tables, DatabaseError};
use reth_db_api::transaction::{DbTx, DbTxMut};
use reth_db::{mdbx::tx::Tx, static_file::iter_static_files, DatabaseError};
use reth_db_api::{
tables,
transaction::{DbTx, DbTxMut},
};
use reth_db_common::{
init::{insert_genesis_header, insert_genesis_history, insert_genesis_state},
DbTool,

View File

@ -1,10 +1,8 @@
use std::sync::Arc;
use super::setup;
use reth_consensus::{noop::NoopConsensus, ConsensusError, FullConsensus};
use reth_db::{tables, DatabaseEnv};
use reth_db::DatabaseEnv;
use reth_db_api::{
cursor::DbCursorRO, database::Database, table::TableImporter, transaction::DbTx,
cursor::DbCursorRO, database::Database, table::TableImporter, tables, transaction::DbTx,
};
use reth_db_common::DbTool;
use reth_evm::{execute::BlockExecutorProvider, noop::NoopBlockExecutorProvider};
@ -15,6 +13,7 @@ use reth_provider::{
DatabaseProviderFactory, ProviderFactory,
};
use reth_stages::{stages::ExecutionStage, Stage, StageCheckpoint, UnwindInput};
use std::sync::Arc;
use tracing::info;
pub(crate) async fn dump_execution_stage<N, E, C>(

View File

@ -1,10 +1,8 @@
use std::sync::Arc;
use super::setup;
use alloy_primitives::BlockNumber;
use eyre::Result;
use reth_db::{tables, DatabaseEnv};
use reth_db_api::{database::Database, table::TableImporter};
use reth_db::DatabaseEnv;
use reth_db_api::{database::Database, table::TableImporter, tables};
use reth_db_common::DbTool;
use reth_node_core::dirs::{ChainPath, DataDirPath};
use reth_provider::{
@ -12,6 +10,7 @@ use reth_provider::{
DatabaseProviderFactory, ProviderFactory,
};
use reth_stages::{stages::AccountHashingStage, Stage, StageCheckpoint, UnwindInput};
use std::sync::Arc;
use tracing::info;
pub(crate) async fn dump_hashing_account_stage<N: ProviderNodeTypes<DB = Arc<DatabaseEnv>>>(

View File

@ -1,9 +1,7 @@
use std::sync::Arc;
use super::setup;
use eyre::Result;
use reth_db::{tables, DatabaseEnv};
use reth_db_api::{database::Database, table::TableImporter};
use reth_db::DatabaseEnv;
use reth_db_api::{database::Database, table::TableImporter, tables};
use reth_db_common::DbTool;
use reth_node_core::dirs::{ChainPath, DataDirPath};
use reth_provider::{
@ -11,6 +9,7 @@ use reth_provider::{
DatabaseProviderFactory, ProviderFactory,
};
use reth_stages::{stages::StorageHashingStage, Stage, StageCheckpoint, UnwindInput};
use std::sync::Arc;
use tracing::info;
pub(crate) async fn dump_hashing_storage_stage<N: ProviderNodeTypes<DB = Arc<DatabaseEnv>>>(

View File

@ -5,8 +5,8 @@ use alloy_primitives::BlockNumber;
use eyre::Result;
use reth_config::config::EtlConfig;
use reth_consensus::noop::NoopConsensus;
use reth_db::{tables, DatabaseEnv};
use reth_db_api::{database::Database, table::TableImporter};
use reth_db::DatabaseEnv;
use reth_db_api::{database::Database, table::TableImporter, tables};
use reth_db_common::DbTool;
use reth_evm::noop::NoopBlockExecutorProvider;
use reth_exex::ExExManagerHandle;

View File

@ -3,9 +3,9 @@ use crate::common::{AccessRights, CliNodeComponents, CliNodeTypes, Environment,
use clap::Parser;
use reth_chainspec::{EthChainSpec, EthereumHardforks};
use reth_cli::chainspec::ChainSpecParser;
use reth_db::{init_db, mdbx::DatabaseArguments, tables, DatabaseEnv};
use reth_db::{init_db, mdbx::DatabaseArguments, DatabaseEnv};
use reth_db_api::{
cursor::DbCursorRO, database::Database, models::ClientVersion, table::TableImporter,
cursor::DbCursorRO, database::Database, models::ClientVersion, table::TableImporter, tables,
transaction::DbTx,
};
use reth_db_common::DbTool;

View File

@ -8,8 +8,10 @@ use proptest::{
test_runner::{TestRng, TestRunner},
};
use proptest_arbitrary_interop::arb;
use reth_db::tables;
use reth_db_api::table::{DupSort, Table, TableRow};
use reth_db_api::{
table::{DupSort, Table, TableRow},
tables,
};
use reth_fs_util as fs;
use reth_primitives::TransactionSigned;
use std::collections::HashSet;