From ed7571fa33507e791d8bffb88e094f0bc95e88a6 Mon Sep 17 00:00:00 2001 From: "hinto.janai" Date: Mon, 17 Jun 2024 15:40:15 -0400 Subject: [PATCH] rename, fix database config --- Cargo.toml | 4 ++-- consensus/fast-sync/Cargo.toml | 2 +- storage/{cuprate-blockchain => blockchain}/Cargo.toml | 0 storage/{cuprate-blockchain => blockchain}/OLD_README.md | 0 storage/{cuprate-blockchain => blockchain}/README.md | 0 .../src/config/backend.rs | 0 .../src/config/config.rs | 0 .../{cuprate-blockchain => blockchain}/src/config/mod.rs | 0 .../src/config/reader_threads.rs | 0 .../{cuprate-blockchain => blockchain}/src/constants.rs | 0 storage/{cuprate-blockchain => blockchain}/src/free.rs | 0 storage/{cuprate-blockchain => blockchain}/src/lib.rs | 0 .../{cuprate-blockchain => blockchain}/src/open_tables.rs | 0 .../{cuprate-blockchain => blockchain}/src/ops/block.rs | 0 .../src/ops/blockchain.rs | 0 .../src/ops/key_image.rs | 0 .../{cuprate-blockchain => blockchain}/src/ops/macros.rs | 0 storage/{cuprate-blockchain => blockchain}/src/ops/mod.rs | 0 .../{cuprate-blockchain => blockchain}/src/ops/output.rs | 0 .../{cuprate-blockchain => blockchain}/src/ops/property.rs | 0 storage/{cuprate-blockchain => blockchain}/src/ops/tx.rs | 0 .../{cuprate-blockchain => blockchain}/src/service/free.rs | 0 .../{cuprate-blockchain => blockchain}/src/service/mod.rs | 0 .../{cuprate-blockchain => blockchain}/src/service/read.rs | 0 .../src/service/tests.rs | 0 .../src/service/types.rs | 0 .../src/service/write.rs | 0 storage/{cuprate-blockchain => blockchain}/src/tables.rs | 0 storage/{cuprate-blockchain => blockchain}/src/tests.rs | 0 storage/{cuprate-blockchain => blockchain}/src/types.rs | 0 .../src/unsafe_sendable.rs | 0 storage/database/README.md | 5 +++-- storage/database/src/config/config.rs | 7 ++++--- storage/database/src/config/mod.rs | 2 +- storage/{cuprate-txpool => txpool}/Cargo.toml | 0 storage/{cuprate-txpool => txpool}/src/lib.rs | 0 36 files changed, 11 insertions(+), 9 deletions(-) rename storage/{cuprate-blockchain => blockchain}/Cargo.toml (100%) rename storage/{cuprate-blockchain => blockchain}/OLD_README.md (100%) rename storage/{cuprate-blockchain => blockchain}/README.md (100%) rename storage/{cuprate-blockchain => blockchain}/src/config/backend.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/config/config.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/config/mod.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/config/reader_threads.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/constants.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/free.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/lib.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/open_tables.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/ops/block.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/ops/blockchain.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/ops/key_image.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/ops/macros.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/ops/mod.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/ops/output.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/ops/property.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/ops/tx.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/service/free.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/service/mod.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/service/read.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/service/tests.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/service/types.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/service/write.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/tables.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/tests.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/types.rs (100%) rename storage/{cuprate-blockchain => blockchain}/src/unsafe_sendable.rs (100%) rename storage/{cuprate-txpool => txpool}/Cargo.toml (100%) rename storage/{cuprate-txpool => txpool}/src/lib.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 8100af7..d6dc202 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,8 +16,8 @@ members = [ "p2p/monero-p2p", "p2p/async-buffer", "p2p/address-book", - "storage/cuprate-blockchain", - "storage/cuprate-txpool", + "storage/blockchain", + "storage/txpool", "storage/database", "pruning", "test-utils", diff --git a/consensus/fast-sync/Cargo.toml b/consensus/fast-sync/Cargo.toml index bfd973c..de9d082 100644 --- a/consensus/fast-sync/Cargo.toml +++ b/consensus/fast-sync/Cargo.toml @@ -10,7 +10,7 @@ path = "src/create.rs" [dependencies] clap = { workspace = true, features = ["derive", "std"] } -cuprate-blockchain = { path = "../../storage/cuprate-blockchain" } +cuprate-blockchain = { path = "../../storage/blockchain" } cuprate-types = { path = "../../types" } hex.workspace = true hex-literal.workspace = true diff --git a/storage/cuprate-blockchain/Cargo.toml b/storage/blockchain/Cargo.toml similarity index 100% rename from storage/cuprate-blockchain/Cargo.toml rename to storage/blockchain/Cargo.toml diff --git a/storage/cuprate-blockchain/OLD_README.md b/storage/blockchain/OLD_README.md similarity index 100% rename from storage/cuprate-blockchain/OLD_README.md rename to storage/blockchain/OLD_README.md diff --git a/storage/cuprate-blockchain/README.md b/storage/blockchain/README.md similarity index 100% rename from storage/cuprate-blockchain/README.md rename to storage/blockchain/README.md diff --git a/storage/cuprate-blockchain/src/config/backend.rs b/storage/blockchain/src/config/backend.rs similarity index 100% rename from storage/cuprate-blockchain/src/config/backend.rs rename to storage/blockchain/src/config/backend.rs diff --git a/storage/cuprate-blockchain/src/config/config.rs b/storage/blockchain/src/config/config.rs similarity index 100% rename from storage/cuprate-blockchain/src/config/config.rs rename to storage/blockchain/src/config/config.rs diff --git a/storage/cuprate-blockchain/src/config/mod.rs b/storage/blockchain/src/config/mod.rs similarity index 100% rename from storage/cuprate-blockchain/src/config/mod.rs rename to storage/blockchain/src/config/mod.rs diff --git a/storage/cuprate-blockchain/src/config/reader_threads.rs b/storage/blockchain/src/config/reader_threads.rs similarity index 100% rename from storage/cuprate-blockchain/src/config/reader_threads.rs rename to storage/blockchain/src/config/reader_threads.rs diff --git a/storage/cuprate-blockchain/src/constants.rs b/storage/blockchain/src/constants.rs similarity index 100% rename from storage/cuprate-blockchain/src/constants.rs rename to storage/blockchain/src/constants.rs diff --git a/storage/cuprate-blockchain/src/free.rs b/storage/blockchain/src/free.rs similarity index 100% rename from storage/cuprate-blockchain/src/free.rs rename to storage/blockchain/src/free.rs diff --git a/storage/cuprate-blockchain/src/lib.rs b/storage/blockchain/src/lib.rs similarity index 100% rename from storage/cuprate-blockchain/src/lib.rs rename to storage/blockchain/src/lib.rs diff --git a/storage/cuprate-blockchain/src/open_tables.rs b/storage/blockchain/src/open_tables.rs similarity index 100% rename from storage/cuprate-blockchain/src/open_tables.rs rename to storage/blockchain/src/open_tables.rs diff --git a/storage/cuprate-blockchain/src/ops/block.rs b/storage/blockchain/src/ops/block.rs similarity index 100% rename from storage/cuprate-blockchain/src/ops/block.rs rename to storage/blockchain/src/ops/block.rs diff --git a/storage/cuprate-blockchain/src/ops/blockchain.rs b/storage/blockchain/src/ops/blockchain.rs similarity index 100% rename from storage/cuprate-blockchain/src/ops/blockchain.rs rename to storage/blockchain/src/ops/blockchain.rs diff --git a/storage/cuprate-blockchain/src/ops/key_image.rs b/storage/blockchain/src/ops/key_image.rs similarity index 100% rename from storage/cuprate-blockchain/src/ops/key_image.rs rename to storage/blockchain/src/ops/key_image.rs diff --git a/storage/cuprate-blockchain/src/ops/macros.rs b/storage/blockchain/src/ops/macros.rs similarity index 100% rename from storage/cuprate-blockchain/src/ops/macros.rs rename to storage/blockchain/src/ops/macros.rs diff --git a/storage/cuprate-blockchain/src/ops/mod.rs b/storage/blockchain/src/ops/mod.rs similarity index 100% rename from storage/cuprate-blockchain/src/ops/mod.rs rename to storage/blockchain/src/ops/mod.rs diff --git a/storage/cuprate-blockchain/src/ops/output.rs b/storage/blockchain/src/ops/output.rs similarity index 100% rename from storage/cuprate-blockchain/src/ops/output.rs rename to storage/blockchain/src/ops/output.rs diff --git a/storage/cuprate-blockchain/src/ops/property.rs b/storage/blockchain/src/ops/property.rs similarity index 100% rename from storage/cuprate-blockchain/src/ops/property.rs rename to storage/blockchain/src/ops/property.rs diff --git a/storage/cuprate-blockchain/src/ops/tx.rs b/storage/blockchain/src/ops/tx.rs similarity index 100% rename from storage/cuprate-blockchain/src/ops/tx.rs rename to storage/blockchain/src/ops/tx.rs diff --git a/storage/cuprate-blockchain/src/service/free.rs b/storage/blockchain/src/service/free.rs similarity index 100% rename from storage/cuprate-blockchain/src/service/free.rs rename to storage/blockchain/src/service/free.rs diff --git a/storage/cuprate-blockchain/src/service/mod.rs b/storage/blockchain/src/service/mod.rs similarity index 100% rename from storage/cuprate-blockchain/src/service/mod.rs rename to storage/blockchain/src/service/mod.rs diff --git a/storage/cuprate-blockchain/src/service/read.rs b/storage/blockchain/src/service/read.rs similarity index 100% rename from storage/cuprate-blockchain/src/service/read.rs rename to storage/blockchain/src/service/read.rs diff --git a/storage/cuprate-blockchain/src/service/tests.rs b/storage/blockchain/src/service/tests.rs similarity index 100% rename from storage/cuprate-blockchain/src/service/tests.rs rename to storage/blockchain/src/service/tests.rs diff --git a/storage/cuprate-blockchain/src/service/types.rs b/storage/blockchain/src/service/types.rs similarity index 100% rename from storage/cuprate-blockchain/src/service/types.rs rename to storage/blockchain/src/service/types.rs diff --git a/storage/cuprate-blockchain/src/service/write.rs b/storage/blockchain/src/service/write.rs similarity index 100% rename from storage/cuprate-blockchain/src/service/write.rs rename to storage/blockchain/src/service/write.rs diff --git a/storage/cuprate-blockchain/src/tables.rs b/storage/blockchain/src/tables.rs similarity index 100% rename from storage/cuprate-blockchain/src/tables.rs rename to storage/blockchain/src/tables.rs diff --git a/storage/cuprate-blockchain/src/tests.rs b/storage/blockchain/src/tests.rs similarity index 100% rename from storage/cuprate-blockchain/src/tests.rs rename to storage/blockchain/src/tests.rs diff --git a/storage/cuprate-blockchain/src/types.rs b/storage/blockchain/src/types.rs similarity index 100% rename from storage/cuprate-blockchain/src/types.rs rename to storage/blockchain/src/types.rs diff --git a/storage/cuprate-blockchain/src/unsafe_sendable.rs b/storage/blockchain/src/unsafe_sendable.rs similarity index 100% rename from storage/cuprate-blockchain/src/unsafe_sendable.rs rename to storage/blockchain/src/unsafe_sendable.rs diff --git a/storage/database/README.md b/storage/database/README.md index 3fffeb2..f041175 100644 --- a/storage/database/README.md +++ b/storage/database/README.md @@ -95,8 +95,9 @@ use cuprate_database::{ # fn main() -> Result<(), Box> { // Create a configuration for the database environment. -let db_dir = tempfile::tempdir()?; -let config = ConfigBuilder::new(db_dir.path().to_path_buf()).build(); +let tmp_dir = tempfile::tempdir()?; +let db_dir = tmp_dir.path().to_owned(); +let config = ConfigBuilder::new(db_dir.into()).build(); // Initialize the database environment. let env = ConcreteEnv::open(config)?; diff --git a/storage/database/src/config/config.rs b/storage/database/src/config/config.rs index 8c897b7..f909c96 100644 --- a/storage/database/src/config/config.rs +++ b/storage/database/src/config/config.rs @@ -186,10 +186,11 @@ impl Config { /// ```rust /// use cuprate_database::{config::*, resize::*, DATABASE_DATA_FILENAME}; /// - /// let db_directory = tempfile::tempdir().unwrap(); - /// let config = Config::new(db_directory.path().into()); + /// let tmp_dir = tempfile::tempdir().unwrap(); + /// let db_directory = tmp_dir.path().to_owned(); + /// let config = Config::new(db_directory.clone().into()); /// - /// assert_eq!(config.db_directory(), db_directory.path()); + /// assert_eq!(*config.db_directory(), db_directory); /// assert!(config.db_file().starts_with(db_directory)); /// assert!(config.db_file().ends_with(DATABASE_DATA_FILENAME)); /// assert_eq!(config.sync_mode, SyncMode::default()); diff --git a/storage/database/src/config/mod.rs b/storage/database/src/config/mod.rs index 25efe11..19a324e 100644 --- a/storage/database/src/config/mod.rs +++ b/storage/database/src/config/mod.rs @@ -20,7 +20,7 @@ //! # fn main() -> Result<(), Box> { //! let db_dir = tempfile::tempdir()?; //! -//! let config = ConfigBuilder::new(db_dir.path().to_path_buf()) +//! let config = ConfigBuilder::new(db_dir.path().to_path_buf().into()) //! // Use the fastest sync mode. //! .sync_mode(SyncMode::Fast) //! // Build into `Config` diff --git a/storage/cuprate-txpool/Cargo.toml b/storage/txpool/Cargo.toml similarity index 100% rename from storage/cuprate-txpool/Cargo.toml rename to storage/txpool/Cargo.toml diff --git a/storage/cuprate-txpool/src/lib.rs b/storage/txpool/src/lib.rs similarity index 100% rename from storage/cuprate-txpool/src/lib.rs rename to storage/txpool/src/lib.rs