Breaking changes (#5191)

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>
Co-authored-by: Roman Krasiuk <rokrassyuk@gmail.com>
Co-authored-by: joshieDo <ranriver@protonmail.com>
Co-authored-by: joshieDo <93316087+joshieDo@users.noreply.github.com>
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Co-authored-by: Oliver Nordbjerg <hi@notbjerg.me>
Co-authored-by: Thomas Coratger <thomas.coratger@gmail.com>
This commit is contained in:
Alexey Shekhirin
2024-02-29 12:37:28 +00:00
committed by GitHub
parent 025fa5f038
commit 6b5b6f7a40
252 changed files with 10154 additions and 6327 deletions

View File

@ -67,7 +67,7 @@ pub mod abstraction;
mod implementation;
mod metrics;
pub mod snapshot;
pub mod static_file;
pub mod tables;
mod utils;
pub mod version;
@ -98,7 +98,7 @@ pub fn init_db<P: AsRef<Path>>(path: P, args: DatabaseArguments) -> eyre::Result
let rpath = path.as_ref();
if is_database_empty(rpath) {
std::fs::create_dir_all(rpath)
reth_primitives::fs::create_dir_all(rpath)
.wrap_err_with(|| format!("Could not create database directory {}", rpath.display()))?;
create_db_version_file(rpath)?;
} else {
@ -163,6 +163,8 @@ pub mod test_utils {
pub const ERROR_DB_OPEN: &str = "Not able to open the database file.";
/// Error during database creation
pub const ERROR_DB_CREATION: &str = "Not able to create the database file.";
/// Error during database creation
pub const ERROR_STATIC_FILES_CREATION: &str = "Not able to create the static file path.";
/// Error during table creation
pub const ERROR_TABLE_CREATION: &str = "Not able to create tables in the database.";
/// Error during tempdir creation
@ -225,6 +227,15 @@ pub mod test_utils {
}
}
/// Create static_files path for testing
pub fn create_test_static_files_dir() -> PathBuf {
let path = tempdir_path();
let emsg = format!("{}: {:?}", ERROR_STATIC_FILES_CREATION, path);
reth_primitives::fs::create_dir_all(path.clone()).expect(&emsg);
path
}
/// Get a temporary directory path to use for the database
pub fn tempdir_path() -> PathBuf {
let builder = tempfile::Builder::new().prefix("reth-test-").rand_bytes(8).tempdir();