mirror of
https://github.com/hinto-janai/cuprate.git
synced 2024-12-22 19:49:33 +00:00
rename, fix database config
This commit is contained in:
parent
33ca4ea408
commit
ed7571fa33
36 changed files with 11 additions and 9 deletions
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)?;
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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`
|
||||
|
|
Loading…
Reference in a new issue