mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: split db abstraction into new crate (#8594)
This commit is contained in:
@ -18,6 +18,7 @@ reth-config.workspace = true
|
||||
reth-primitives = { workspace = true, features = ["arbitrary", "clap"] }
|
||||
reth-fs-util.workspace = true
|
||||
reth-db = { workspace = true, features = ["mdbx"] }
|
||||
reth-db-api.workspace = true
|
||||
reth-exex.workspace = true
|
||||
reth-provider = { workspace = true }
|
||||
reth-evm.workspace = true
|
||||
|
||||
@ -4,10 +4,8 @@ use crate::{
|
||||
};
|
||||
use ahash::RandomState;
|
||||
use clap::Parser;
|
||||
use reth_db::{
|
||||
cursor::DbCursorRO, database::Database, table::Table, transaction::DbTx, DatabaseEnv, RawKey,
|
||||
RawTable, RawValue, TableViewer, Tables,
|
||||
};
|
||||
use reth_db::{DatabaseEnv, RawKey, RawTable, RawValue, TableViewer, Tables};
|
||||
use reth_db_api::{cursor::DbCursorRO, database::Database, table::Table, transaction::DbTx};
|
||||
use std::{
|
||||
hash::{BuildHasher, Hasher},
|
||||
sync::Arc,
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
use clap::{Parser, Subcommand};
|
||||
use reth_db::{
|
||||
use reth_db::{static_file::iter_static_files, TableViewer, Tables};
|
||||
use reth_db_api::{
|
||||
database::Database,
|
||||
static_file::iter_static_files,
|
||||
table::Table,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
TableViewer, Tables,
|
||||
};
|
||||
use reth_primitives::{static_file::find_fixed_range, StaticFileSegment};
|
||||
use reth_provider::{ProviderFactory, StaticFileProviderFactory};
|
||||
|
||||
@ -4,10 +4,8 @@ use crate::{
|
||||
utils::DbTool,
|
||||
};
|
||||
use clap::Parser;
|
||||
use reth_db::{
|
||||
cursor::DbCursorRO, database::Database, open_db_read_only, table::Table, tables_to_generic,
|
||||
transaction::DbTx, DatabaseEnv, Tables,
|
||||
};
|
||||
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 std::{
|
||||
collections::HashMap,
|
||||
fmt::Debug,
|
||||
@ -95,7 +93,7 @@ where
|
||||
T::Key: Hash,
|
||||
T::Value: PartialEq,
|
||||
{
|
||||
let table = T::TABLE;
|
||||
let table = T::NAME;
|
||||
|
||||
info!("Analyzing table {table}...");
|
||||
let result = find_diffs_advanced::<T>(&primary_tx, &secondary_tx)?;
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
use crate::utils::DbTool;
|
||||
use clap::Parser;
|
||||
use reth_db::{
|
||||
database::Database,
|
||||
static_file::{ColumnSelectorOne, ColumnSelectorTwo, HeaderMask, ReceiptMask, TransactionMask},
|
||||
table::{Decompress, DupSort, Table},
|
||||
tables, RawKey, RawTable, Receipts, TableViewer, Transactions,
|
||||
};
|
||||
use reth_db_api::{
|
||||
database::Database,
|
||||
table::{Decompress, DupSort, Table},
|
||||
};
|
||||
use reth_primitives::{BlockHash, Header, StaticFileSegment};
|
||||
use reth_provider::StaticFileProviderFactory;
|
||||
use tracing::error;
|
||||
@ -200,10 +202,8 @@ pub(crate) fn maybe_json_value_parser(value: &str) -> Result<String, eyre::Error
|
||||
mod tests {
|
||||
use super::*;
|
||||
use clap::{Args, Parser};
|
||||
use reth_db::{
|
||||
models::{storage_sharded_key::StorageShardedKey, ShardedKey},
|
||||
AccountsHistory, HashedAccounts, Headers, StageCheckpoints, StoragesHistory,
|
||||
};
|
||||
use reth_db::{AccountsHistory, HashedAccounts, Headers, StageCheckpoints, StoragesHistory};
|
||||
use reth_db_api::models::{storage_sharded_key::StorageShardedKey, ShardedKey};
|
||||
use reth_primitives::{Address, B256};
|
||||
use std::str::FromStr;
|
||||
|
||||
|
||||
@ -2,7 +2,8 @@ use super::tui::DbListTUI;
|
||||
use crate::utils::{DbTool, ListFilter};
|
||||
use clap::Parser;
|
||||
use eyre::WrapErr;
|
||||
use reth_db::{database::Database, table::Table, DatabaseEnv, RawValue, TableViewer, Tables};
|
||||
use reth_db::{DatabaseEnv, RawValue, TableViewer, Tables};
|
||||
use reth_db_api::{database::Database, table::Table};
|
||||
use reth_primitives::hex;
|
||||
use std::{cell::RefCell, sync::Arc};
|
||||
use tracing::error;
|
||||
|
||||
@ -4,9 +4,8 @@ use comfy_table::{Cell, Row, Table as ComfyTable};
|
||||
use eyre::WrapErr;
|
||||
use human_bytes::human_bytes;
|
||||
use itertools::Itertools;
|
||||
use reth_db::{
|
||||
database::Database, mdbx, static_file::iter_static_files, DatabaseEnv, TableViewer, Tables,
|
||||
};
|
||||
use reth_db::{mdbx, static_file::iter_static_files, DatabaseEnv, TableViewer, Tables};
|
||||
use reth_db_api::database::Database;
|
||||
use reth_fs_util as fs;
|
||||
use reth_node_core::dirs::{ChainPath, DataDirPath};
|
||||
use reth_primitives::static_file::{find_fixed_range, SegmentRangeInclusive};
|
||||
|
||||
@ -10,10 +10,8 @@ use ratatui::{
|
||||
widgets::{Block, Borders, List, ListItem, ListState, Paragraph, Wrap},
|
||||
Frame, Terminal,
|
||||
};
|
||||
use reth_db::{
|
||||
table::{Table, TableRow},
|
||||
RawValue,
|
||||
};
|
||||
use reth_db::RawValue;
|
||||
use reth_db_api::table::{Table, TableRow};
|
||||
use std::{
|
||||
io,
|
||||
time::{Duration, Instant},
|
||||
|
||||
@ -12,7 +12,8 @@ use reth_beacon_consensus::EthBeaconConsensus;
|
||||
use reth_cli_runner::CliContext;
|
||||
use reth_config::Config;
|
||||
use reth_consensus::Consensus;
|
||||
use reth_db::{database::Database, DatabaseEnv};
|
||||
use reth_db::DatabaseEnv;
|
||||
use reth_db_api::database::Database;
|
||||
use reth_downloaders::{
|
||||
bodies::bodies::BodiesDownloaderBuilder,
|
||||
headers::reverse_headers::ReverseHeadersDownloaderBuilder,
|
||||
|
||||
@ -12,7 +12,8 @@ use reth_beacon_consensus::EthBeaconConsensus;
|
||||
use reth_cli_runner::CliContext;
|
||||
use reth_config::Config;
|
||||
use reth_consensus::Consensus;
|
||||
use reth_db::{cursor::DbCursorRO, tables, transaction::DbTx, DatabaseEnv};
|
||||
use reth_db::{tables, DatabaseEnv};
|
||||
use reth_db_api::{cursor::DbCursorRO, transaction::DbTx};
|
||||
use reth_evm::execute::{BatchBlockExecutionOutput, BatchExecutor, BlockExecutorProvider};
|
||||
use reth_network::NetworkHandle;
|
||||
use reth_network_api::NetworkInfo;
|
||||
|
||||
@ -10,7 +10,8 @@ use futures::{Stream, StreamExt};
|
||||
use reth_beacon_consensus::EthBeaconConsensus;
|
||||
use reth_config::Config;
|
||||
use reth_consensus::Consensus;
|
||||
use reth_db::{database::Database, tables, transaction::DbTx};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{database::Database, transaction::DbTx};
|
||||
use reth_downloaders::{
|
||||
bodies::bodies::BodiesDownloaderBuilder,
|
||||
file_client::{ChunkedFileReader, FileClient, DEFAULT_BYTE_LEN_CHUNK_CHAIN_FILE},
|
||||
|
||||
@ -10,7 +10,8 @@ use crate::{
|
||||
};
|
||||
use clap::Parser;
|
||||
use reth_consensus::noop::NoopConsensus;
|
||||
use reth_db::{tables, transaction::DbTx};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::transaction::DbTx;
|
||||
use reth_downloaders::file_client::{
|
||||
ChunkedFileReader, FileClient, DEFAULT_BYTE_LEN_CHUNK_CHAIN_FILE,
|
||||
};
|
||||
|
||||
@ -3,7 +3,8 @@
|
||||
|
||||
use crate::commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use clap::Parser;
|
||||
use reth_db::{database::Database, tables, transaction::DbTx};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{database::Database, transaction::DbTx};
|
||||
use reth_downloaders::{
|
||||
file_client::{ChunkedFileReader, DEFAULT_BYTE_LEN_CHUNK_CHAIN_FILE},
|
||||
receipt_file_client::ReceiptFileClient,
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
use crate::commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use clap::Parser;
|
||||
use reth_config::config::EtlConfig;
|
||||
use reth_db::database::Database;
|
||||
use reth_db_api::database::Database;
|
||||
use reth_db_common::init::init_from_state_dump;
|
||||
use reth_primitives::B256;
|
||||
use reth_provider::ProviderFactory;
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
use crate::commands::common::{AccessRights, Environment, EnvironmentArgs};
|
||||
use clap::Parser;
|
||||
use reth_cli_runner::CliContext;
|
||||
use reth_db::{
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbDupCursorRW},
|
||||
tables,
|
||||
transaction::DbTx,
|
||||
};
|
||||
use reth_provider::{BlockNumReader, HeaderProvider, ProviderError};
|
||||
|
||||
@ -7,7 +7,8 @@ use crate::{
|
||||
};
|
||||
use clap::Parser;
|
||||
use itertools::Itertools;
|
||||
use reth_db::{static_file::iter_static_files, tables, transaction::DbTxMut, DatabaseEnv};
|
||||
use reth_db::{static_file::iter_static_files, tables, DatabaseEnv};
|
||||
use reth_db_api::transaction::DbTxMut;
|
||||
use reth_db_common::init::{insert_genesis_header, insert_genesis_history, insert_genesis_state};
|
||||
use reth_primitives::{stage::StageId, static_file::find_fixed_range, StaticFileSegment};
|
||||
use reth_provider::{providers::StaticFileWriter, StaticFileProviderFactory};
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
use super::setup;
|
||||
use crate::{macros::block_executor, utils::DbTool};
|
||||
use reth_db::{
|
||||
cursor::DbCursorRO, database::Database, table::TableImporter, tables, transaction::DbTx,
|
||||
DatabaseEnv,
|
||||
use reth_db::{tables, DatabaseEnv};
|
||||
use reth_db_api::{
|
||||
cursor::DbCursorRO, database::Database, table::TableImporter, transaction::DbTx,
|
||||
};
|
||||
use reth_node_core::dirs::{ChainPath, DataDirPath};
|
||||
use reth_primitives::stage::StageCheckpoint;
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
use super::setup;
|
||||
use crate::utils::DbTool;
|
||||
use eyre::Result;
|
||||
use reth_db::{database::Database, table::TableImporter, tables, DatabaseEnv};
|
||||
use reth_db::{tables, DatabaseEnv};
|
||||
use reth_db_api::{database::Database, table::TableImporter};
|
||||
use reth_node_core::dirs::{ChainPath, DataDirPath};
|
||||
use reth_primitives::{stage::StageCheckpoint, BlockNumber};
|
||||
use reth_provider::{providers::StaticFileProvider, ProviderFactory};
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
use super::setup;
|
||||
use crate::utils::DbTool;
|
||||
use eyre::Result;
|
||||
use reth_db::{database::Database, table::TableImporter, tables, DatabaseEnv};
|
||||
use reth_db::{tables, DatabaseEnv};
|
||||
use reth_db_api::{database::Database, table::TableImporter};
|
||||
use reth_node_core::dirs::{ChainPath, DataDirPath};
|
||||
use reth_primitives::stage::StageCheckpoint;
|
||||
use reth_provider::{providers::StaticFileProvider, ProviderFactory};
|
||||
|
||||
@ -2,7 +2,8 @@ use super::setup;
|
||||
use crate::{macros::block_executor, utils::DbTool};
|
||||
use eyre::Result;
|
||||
use reth_config::config::EtlConfig;
|
||||
use reth_db::{database::Database, table::TableImporter, tables, DatabaseEnv};
|
||||
use reth_db::{tables, DatabaseEnv};
|
||||
use reth_db_api::{database::Database, table::TableImporter};
|
||||
use reth_exex::ExExManagerHandle;
|
||||
use reth_node_core::dirs::{ChainPath, DataDirPath};
|
||||
use reth_primitives::{stage::StageCheckpoint, BlockNumber, PruneModes};
|
||||
|
||||
@ -8,10 +8,10 @@ use crate::{
|
||||
|
||||
use crate::args::DatadirArgs;
|
||||
use clap::Parser;
|
||||
use reth_db::{
|
||||
cursor::DbCursorRO, database::Database, init_db, mdbx::DatabaseArguments,
|
||||
models::client_version::ClientVersion, table::TableImporter, tables, transaction::DbTx,
|
||||
DatabaseEnv,
|
||||
use reth_db::{init_db, mdbx::DatabaseArguments, tables, DatabaseEnv};
|
||||
use reth_db_api::{
|
||||
cursor::DbCursorRO, database::Database, models::ClientVersion, table::TableImporter,
|
||||
transaction::DbTx,
|
||||
};
|
||||
use reth_node_core::dirs::PlatformPath;
|
||||
use std::path::PathBuf;
|
||||
|
||||
@ -4,7 +4,7 @@ use clap::{Parser, Subcommand};
|
||||
use reth_beacon_consensus::EthBeaconConsensus;
|
||||
use reth_config::Config;
|
||||
use reth_consensus::Consensus;
|
||||
use reth_db::database::Database;
|
||||
use reth_db_api::database::Database;
|
||||
use reth_downloaders::{bodies::noop::NoopBodiesDownloader, headers::noop::NoopHeaderDownloader};
|
||||
use reth_exex::ExExManagerHandle;
|
||||
use reth_node_core::args::NetworkArgs;
|
||||
|
||||
@ -7,10 +7,8 @@ use proptest::{
|
||||
strategy::{Strategy, ValueTree},
|
||||
test_runner::TestRunner,
|
||||
};
|
||||
use reth_db::{
|
||||
table::{DupSort, Table, TableRow},
|
||||
tables,
|
||||
};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::table::{DupSort, Table, TableRow};
|
||||
use reth_fs_util as fs;
|
||||
use tracing::error;
|
||||
|
||||
|
||||
@ -2,12 +2,13 @@
|
||||
|
||||
use boyer_moore_magiclen::BMByte;
|
||||
use eyre::Result;
|
||||
use reth_db::{
|
||||
use reth_db::{RawTable, TableRawRow};
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbDupCursorRO},
|
||||
database::Database,
|
||||
table::{Decode, Decompress, DupSort, Table, TableRow},
|
||||
transaction::{DbTx, DbTxMut},
|
||||
DatabaseError, RawTable, TableRawRow,
|
||||
DatabaseError,
|
||||
};
|
||||
use reth_fs_util as fs;
|
||||
use reth_primitives::ChainSpec;
|
||||
|
||||
Reference in New Issue
Block a user