mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add DatabaseMetrics trait for generic DB in reth node (#5690)
This commit is contained in:
@ -153,7 +153,7 @@ pub fn open_db(path: &Path, log_level: Option<LogLevel>) -> eyre::Result<Databas
|
||||
#[cfg(any(test, feature = "test-utils"))]
|
||||
pub mod test_utils {
|
||||
use super::*;
|
||||
use crate::database::Database;
|
||||
use crate::{database::Database, database_metrics::DatabaseMetrics};
|
||||
use std::{path::PathBuf, sync::Arc};
|
||||
|
||||
/// Error during database open
|
||||
@ -210,6 +210,12 @@ pub mod test_utils {
|
||||
}
|
||||
}
|
||||
|
||||
impl<DB: DatabaseMetrics> DatabaseMetrics for TempDatabase<DB> {
|
||||
fn report_metrics(&self) {
|
||||
self.db().report_metrics()
|
||||
}
|
||||
}
|
||||
|
||||
/// Create read/write database for testing
|
||||
pub fn create_test_rw_db() -> Arc<TempDatabase<DatabaseEnv>> {
|
||||
let path = tempfile::TempDir::new().expect(ERROR_TEMPDIR).into_path();
|
||||
|
||||
Reference in New Issue
Block a user