chore: rm reth db seed (#2818)

This commit is contained in:
Bjerg
2023-05-24 20:15:50 +02:00
committed by GitHub
parent 718dbfc971
commit 86b6c6a773
3 changed files with 3 additions and 34 deletions

View File

@ -60,12 +60,6 @@ pub enum Subcommands {
Stats,
/// Lists the contents of a table
List(ListArgs),
/// Seeds the database with random blocks on top of each other
Seed {
/// How many blocks to generate
#[arg(default_value = DEFAULT_NUM_ITEMS)]
len: u64,
},
/// Deletes all database entries
Drop,
}
@ -150,9 +144,6 @@ impl Command {
println!("{stats_table}");
}
Subcommands::Seed { len } => {
tool.seed(*len)?;
}
Subcommands::List(args) => {
macro_rules! table_tui {
($arg:expr, $start:expr, $len:expr => [$($table:ident),*]) => {

View File

@ -7,15 +7,11 @@ use reth_db::{
table::Table,
transaction::{DbTx, DbTxMut},
};
use reth_interfaces::{
p2p::{
headers::client::{HeadersClient, HeadersRequest},
priority::Priority,
},
test_utils::generators::random_block_range,
use reth_interfaces::p2p::{
headers::client::{HeadersClient, HeadersRequest},
priority::Priority,
};
use reth_primitives::{BlockHashOrNumber, HeadersDirection, SealedHeader};
use reth_provider::insert_canonical_block;
use std::{collections::BTreeMap, path::Path, time::Duration};
use tracing::info;
@ -67,22 +63,6 @@ impl<'a, DB: Database> DbTool<'a, DB> {
Ok(Self { db })
}
/// Seeds the database with some random data, only used for testing
pub fn seed(&mut self, len: u64) -> Result<()> {
info!(target: "reth::cli", "Generating random block range from 0 to {len}");
let chain = random_block_range(0..=len - 1, Default::default(), 0..64);
self.db.update(|tx| {
chain.into_iter().try_for_each(|block| {
insert_canonical_block(tx, block, None)?;
Ok::<_, eyre::Error>(())
})
})??;
info!(target: "reth::cli", "Database seeded with {len} blocks");
Ok(())
}
/// Grabs the contents of the table within a certain index range and places the
/// entries into a [`HashMap`][std::collections::HashMap].
pub fn list<T: Table>(

View File

@ -12,8 +12,6 @@ Commands:
Lists all the tables, their entry count and their size
list
Lists the contents of a table
seed
Seeds the database with random blocks on top of each other
drop
Deletes all database entries
help