mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: phase out environment trait (#5439)
This commit is contained in:
@ -17,7 +17,7 @@ use clap::Parser;
|
||||
use reth_db::{
|
||||
cursor::DbCursorRO, database::Database, open_db_read_only, table::Table, transaction::DbTx,
|
||||
AccountChangeSet, AccountHistory, AccountsTrie, BlockBodyIndices, BlockOmmers,
|
||||
BlockWithdrawals, Bytecodes, CanonicalHeaders, DatabaseEnvRO, HashedAccount, HashedStorage,
|
||||
BlockWithdrawals, Bytecodes, CanonicalHeaders, DatabaseEnv, HashedAccount, HashedStorage,
|
||||
HeaderNumbers, HeaderTD, Headers, PlainAccountState, PlainStorageState, PruneCheckpoints,
|
||||
Receipts, StorageChangeSet, StorageHistory, StoragesTrie, SyncStage, SyncStageProgress, Tables,
|
||||
TransactionBlock, Transactions, TxHashNumber, TxSenders,
|
||||
@ -58,7 +58,7 @@ impl Command {
|
||||
///
|
||||
/// The discrepancies and extra elements, along with a brief summary of the diff results are
|
||||
/// then written to a file in the output directory.
|
||||
pub fn execute(self, tool: &DbTool<'_, DatabaseEnvRO>) -> eyre::Result<()> {
|
||||
pub fn execute(self, tool: &DbTool<'_, DatabaseEnv>) -> eyre::Result<()> {
|
||||
// open second db
|
||||
let second_db_path: PathBuf = self.secondary_datadir.join("db").into();
|
||||
let second_db = open_db_read_only(&second_db_path, self.second_db.log_level)?;
|
||||
|
||||
@ -2,7 +2,7 @@ use super::tui::DbListTUI;
|
||||
use crate::utils::{DbTool, ListFilter};
|
||||
use clap::Parser;
|
||||
use eyre::WrapErr;
|
||||
use reth_db::{database::Database, table::Table, DatabaseEnvRO, RawValue, TableViewer, Tables};
|
||||
use reth_db::{database::Database, table::Table, DatabaseEnv, RawValue, TableViewer, Tables};
|
||||
use reth_primitives::hex;
|
||||
use std::cell::RefCell;
|
||||
use tracing::error;
|
||||
@ -50,7 +50,7 @@ pub struct Command {
|
||||
|
||||
impl Command {
|
||||
/// Execute `db list` command
|
||||
pub fn execute(self, tool: &DbTool<'_, DatabaseEnvRO>) -> eyre::Result<()> {
|
||||
pub fn execute(self, tool: &DbTool<'_, DatabaseEnv>) -> eyre::Result<()> {
|
||||
self.table.view(&ListTableViewer { tool, args: &self })
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ impl Command {
|
||||
}
|
||||
|
||||
struct ListTableViewer<'a> {
|
||||
tool: &'a DbTool<'a, DatabaseEnvRO>,
|
||||
tool: &'a DbTool<'a, DatabaseEnv>,
|
||||
args: &'a Command,
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use reth_db::DatabaseEnvRO;
|
||||
use reth_db::DatabaseEnv;
|
||||
use reth_primitives::{
|
||||
snapshot::{Compression, Filters},
|
||||
ChainSpec, SnapshotSegment,
|
||||
@ -16,7 +16,7 @@ pub(crate) enum BenchKind {
|
||||
|
||||
pub(crate) fn bench<F1, F2, R>(
|
||||
bench_kind: BenchKind,
|
||||
db: (DatabaseEnvRO, Arc<ChainSpec>),
|
||||
db: (DatabaseEnv, Arc<ChainSpec>),
|
||||
segment: SnapshotSegment,
|
||||
filters: Filters,
|
||||
compression: Compression,
|
||||
@ -25,7 +25,7 @@ pub(crate) fn bench<F1, F2, R>(
|
||||
) -> eyre::Result<()>
|
||||
where
|
||||
F1: FnMut() -> eyre::Result<R>,
|
||||
F2: Fn(DatabaseProviderRO<'_, DatabaseEnvRO>) -> eyre::Result<R>,
|
||||
F2: Fn(DatabaseProviderRO<'_, DatabaseEnv>) -> eyre::Result<R>,
|
||||
R: Debug + PartialEq,
|
||||
{
|
||||
let (db, chain) = db;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
use clap::Parser;
|
||||
use itertools::Itertools;
|
||||
use reth_db::{open_db_read_only, DatabaseEnvRO};
|
||||
use reth_db::{open_db_read_only, DatabaseEnv};
|
||||
use reth_interfaces::db::LogLevel;
|
||||
use reth_primitives::{
|
||||
snapshot::{Compression, InclusionFilter, PerfectHashingFunction},
|
||||
@ -71,22 +71,21 @@ impl Command {
|
||||
if !self.only_bench {
|
||||
for ((mode, compression), phf) in all_combinations.clone() {
|
||||
match mode {
|
||||
SnapshotSegment::Headers => self
|
||||
.generate_headers_snapshot::<DatabaseEnvRO>(
|
||||
&provider,
|
||||
*compression,
|
||||
InclusionFilter::Cuckoo,
|
||||
*phf,
|
||||
)?,
|
||||
SnapshotSegment::Headers => self.generate_headers_snapshot::<DatabaseEnv>(
|
||||
&provider,
|
||||
*compression,
|
||||
InclusionFilter::Cuckoo,
|
||||
*phf,
|
||||
)?,
|
||||
SnapshotSegment::Transactions => self
|
||||
.generate_transactions_snapshot::<DatabaseEnvRO>(
|
||||
.generate_transactions_snapshot::<DatabaseEnv>(
|
||||
&provider,
|
||||
*compression,
|
||||
InclusionFilter::Cuckoo,
|
||||
*phf,
|
||||
)?,
|
||||
SnapshotSegment::Receipts => self
|
||||
.generate_receipts_snapshot::<DatabaseEnvRO>(
|
||||
.generate_receipts_snapshot::<DatabaseEnv>(
|
||||
&provider,
|
||||
*compression,
|
||||
InclusionFilter::Cuckoo,
|
||||
|
||||
Reference in New Issue
Block a user