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:
@ -15,6 +15,7 @@ workspace = true
|
||||
# reth
|
||||
reth-primitives.workspace = true
|
||||
reth-db.workspace = true
|
||||
reth-db-api.workspace = true
|
||||
reth-errors.workspace = true
|
||||
reth-provider.workspace = true
|
||||
reth-tokio-util.workspace = true
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
use crate::{segments::SegmentSet, Pruner};
|
||||
use reth_config::PruneConfig;
|
||||
use reth_db::database::Database;
|
||||
use reth_db_api::database::Database;
|
||||
use reth_primitives::{FinishedExExHeight, PruneModes, MAINNET};
|
||||
use reth_provider::ProviderFactory;
|
||||
use std::time::Duration;
|
||||
|
||||
@ -5,7 +5,7 @@ use crate::{
|
||||
segments::{PruneInput, Segment},
|
||||
Metrics, PrunerError, PrunerEvent,
|
||||
};
|
||||
use reth_db::database::Database;
|
||||
use reth_db_api::database::Database;
|
||||
use reth_primitives::{
|
||||
BlockNumber, FinishedExExHeight, PruneLimiter, PruneMode, PruneProgress, PrunePurpose,
|
||||
PruneSegment, StaticFileSegment,
|
||||
|
||||
@ -4,7 +4,8 @@ use crate::{
|
||||
},
|
||||
PrunerError,
|
||||
};
|
||||
use reth_db::{database::Database, models::ShardedKey, tables};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{database::Database, models::ShardedKey};
|
||||
use reth_primitives::{PruneInterruptReason, PruneMode, PruneProgress, PruneSegment};
|
||||
use reth_provider::DatabaseProviderRW;
|
||||
use tracing::{instrument, trace};
|
||||
|
||||
@ -5,10 +5,10 @@ use crate::{
|
||||
PrunerError,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use reth_db::{
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, RangeWalker},
|
||||
database::Database,
|
||||
tables,
|
||||
transaction::DbTxMut,
|
||||
};
|
||||
|
||||
@ -188,7 +188,8 @@ where
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use assert_matches::assert_matches;
|
||||
use reth_db::{tables, transaction::DbTx};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::transaction::DbTx;
|
||||
use reth_primitives::{
|
||||
BlockNumber, PruneCheckpoint, PruneInterruptReason, PruneLimiter, PruneMode, PruneProgress,
|
||||
PruneSegment, B256, U256,
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
use reth_db::{
|
||||
use reth_db::BlockNumberList;
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbCursorRW},
|
||||
database::Database,
|
||||
models::ShardedKey,
|
||||
table::Table,
|
||||
transaction::DbTxMut,
|
||||
BlockNumberList, DatabaseError,
|
||||
DatabaseError,
|
||||
};
|
||||
use reth_primitives::BlockNumber;
|
||||
use reth_provider::DatabaseProviderRW;
|
||||
|
||||
@ -14,7 +14,7 @@ pub use account_history::AccountHistory;
|
||||
pub use headers::Headers;
|
||||
pub use receipts::Receipts;
|
||||
pub use receipts_by_logs::ReceiptsByLogs;
|
||||
use reth_db::database::Database;
|
||||
use reth_db_api::database::Database;
|
||||
use reth_primitives::{
|
||||
BlockNumber, PruneCheckpoint, PruneInterruptReason, PruneLimiter, PruneMode, PruneProgress,
|
||||
PruneSegment, TxNumber,
|
||||
|
||||
@ -2,7 +2,8 @@ use crate::{
|
||||
segments::{PruneInput, PruneOutput, PruneOutputCheckpoint, Segment},
|
||||
PrunerError,
|
||||
};
|
||||
use reth_db::{database::Database, tables};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::database::Database;
|
||||
use reth_primitives::{PruneCheckpoint, PruneMode, PruneProgress, PruneSegment};
|
||||
use reth_provider::{
|
||||
errors::provider::ProviderResult, DatabaseProviderRW, PruneCheckpointWriter,
|
||||
|
||||
@ -2,7 +2,8 @@ use crate::{
|
||||
segments::{PruneInput, PruneOutput, Segment},
|
||||
PrunerError,
|
||||
};
|
||||
use reth_db::{database::Database, tables};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::database::Database;
|
||||
use reth_primitives::{
|
||||
PruneCheckpoint, PruneMode, PruneProgress, PrunePurpose, PruneSegment, ReceiptsLogPruneConfig,
|
||||
MINIMUM_PRUNING_DISTANCE,
|
||||
@ -216,7 +217,8 @@ impl<DB: Database> Segment<DB> for ReceiptsByLogs {
|
||||
mod tests {
|
||||
use crate::segments::{receipts_by_logs::ReceiptsByLogs, PruneInput, Segment};
|
||||
use assert_matches::assert_matches;
|
||||
use reth_db::{cursor::DbCursorRO, tables, transaction::DbTx};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{cursor::DbCursorRO, transaction::DbTx};
|
||||
use reth_primitives::{PruneLimiter, PruneMode, PruneSegment, ReceiptsLogPruneConfig, B256};
|
||||
use reth_provider::{PruneCheckpointReader, TransactionsProvider};
|
||||
use reth_stages::test_utils::{StorageKind, TestStageDB};
|
||||
|
||||
@ -2,7 +2,8 @@ use crate::{
|
||||
segments::{PruneInput, PruneOutput, PruneOutputCheckpoint, Segment},
|
||||
PrunerError,
|
||||
};
|
||||
use reth_db::{database::Database, tables};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::database::Database;
|
||||
use reth_primitives::{PruneMode, PruneProgress, PruneSegment};
|
||||
use reth_provider::{DatabaseProviderRW, TransactionsProvider};
|
||||
use tracing::{instrument, trace};
|
||||
|
||||
@ -2,7 +2,7 @@ use crate::segments::{
|
||||
AccountHistory, Receipts, ReceiptsByLogs, Segment, SenderRecovery, StorageHistory,
|
||||
TransactionLookup,
|
||||
};
|
||||
use reth_db::database::Database;
|
||||
use reth_db_api::database::Database;
|
||||
use reth_primitives::PruneModes;
|
||||
|
||||
/// Collection of [Segment]. Thread-safe, allocated on the heap.
|
||||
|
||||
@ -4,10 +4,10 @@ use crate::{
|
||||
},
|
||||
PrunerError,
|
||||
};
|
||||
use reth_db::{
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{
|
||||
database::Database,
|
||||
models::{storage_sharded_key::StorageShardedKey, BlockNumberAddress},
|
||||
tables,
|
||||
};
|
||||
use reth_primitives::{PruneInterruptReason, PruneMode, PruneProgress, PruneSegment};
|
||||
use reth_provider::DatabaseProviderRW;
|
||||
|
||||
@ -3,7 +3,8 @@ use crate::{
|
||||
PrunerError,
|
||||
};
|
||||
use rayon::prelude::*;
|
||||
use reth_db::{database::Database, tables};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::database::Database;
|
||||
use reth_primitives::{PruneMode, PruneProgress, PruneSegment};
|
||||
use reth_provider::{DatabaseProviderRW, TransactionsProvider};
|
||||
use tracing::{instrument, trace};
|
||||
|
||||
@ -2,7 +2,8 @@ use crate::{
|
||||
segments::{PruneInput, PruneOutput, PruneOutputCheckpoint, Segment},
|
||||
PrunerError,
|
||||
};
|
||||
use reth_db::{database::Database, tables};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::database::Database;
|
||||
use reth_primitives::{PruneMode, PruneProgress, PruneSegment};
|
||||
use reth_provider::{DatabaseProviderRW, TransactionsProvider};
|
||||
use tracing::{instrument, trace};
|
||||
|
||||
Reference in New Issue
Block a user