rename, fix database config

This commit is contained in:
hinto.janai 2024-06-17 15:40:15 -04:00
parent 33ca4ea408
commit ed7571fa33
No known key found for this signature in database
GPG key ID: D47CE05FA175A499
36 changed files with 11 additions and 9 deletions

View file

@ -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",

View file

@ -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

View file

@ -95,8 +95,9 @@ use cuprate_database::{
# fn main() -> Result<(), Box<dyn std::error::Error>> {
// 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)?;

View file

@ -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());

View file

@ -20,7 +20,7 @@
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! 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`