mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
fix(cli): remove usage of StageDB on DbTool (#448)
* use view and update instead of StageDB * change DbTool docs * clippy
This commit is contained in:
@ -2,11 +2,11 @@ use reth_libmdbx::{Environment, NoWriteMap, WriteFlags};
|
||||
use tempfile::{tempdir, TempDir};
|
||||
|
||||
pub fn get_key(n: u32) -> String {
|
||||
format!("key{}", n)
|
||||
format!("key{n}")
|
||||
}
|
||||
|
||||
pub fn get_data(n: u32) -> String {
|
||||
format!("data{}", n)
|
||||
format!("data{n}")
|
||||
}
|
||||
|
||||
pub fn setup_bench_db(num_rows: u32) -> (TempDir, Environment<NoWriteMap>) {
|
||||
|
||||
@ -261,8 +261,7 @@ fn test_concurrent_writers() {
|
||||
threads.push(thread::spawn(move || {
|
||||
let txn = writer_env.begin_rw_txn().unwrap();
|
||||
let db = txn.open_db(None).unwrap();
|
||||
txn.put(&db, format!("{}{}", key, i), format!("{}{}", val, i), WriteFlags::empty())
|
||||
.unwrap();
|
||||
txn.put(&db, format!("{key}{i}"), format!("{val}{i}"), WriteFlags::empty()).unwrap();
|
||||
txn.commit().is_ok()
|
||||
}));
|
||||
}
|
||||
@ -273,8 +272,8 @@ fn test_concurrent_writers() {
|
||||
|
||||
for i in 0..n {
|
||||
assert_eq!(
|
||||
Cow::<Vec<u8>>::Owned(format!("{}{}", val, i).into_bytes()),
|
||||
txn.get(&db, format!("{}{}", key, i).as_bytes()).unwrap().unwrap()
|
||||
Cow::<Vec<u8>>::Owned(format!("{val}{i}").into_bytes()),
|
||||
txn.get(&db, format!("{key}{i}").as_bytes()).unwrap().unwrap()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user