mirror of
https://github.com/hinto-janai/cuprate.git
synced 2024-12-23 03:59:37 +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/monero-p2p",
|
||||||
"p2p/async-buffer",
|
"p2p/async-buffer",
|
||||||
"p2p/address-book",
|
"p2p/address-book",
|
||||||
"storage/cuprate-blockchain",
|
"storage/blockchain",
|
||||||
"storage/cuprate-txpool",
|
"storage/txpool",
|
||||||
"storage/database",
|
"storage/database",
|
||||||
"pruning",
|
"pruning",
|
||||||
"test-utils",
|
"test-utils",
|
||||||
|
|
|
@ -10,7 +10,7 @@ path = "src/create.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { workspace = true, features = ["derive", "std"] }
|
clap = { workspace = true, features = ["derive", "std"] }
|
||||||
cuprate-blockchain = { path = "../../storage/cuprate-blockchain" }
|
cuprate-blockchain = { path = "../../storage/blockchain" }
|
||||||
cuprate-types = { path = "../../types" }
|
cuprate-types = { path = "../../types" }
|
||||||
hex.workspace = true
|
hex.workspace = true
|
||||||
hex-literal.workspace = true
|
hex-literal.workspace = true
|
||||||
|
|
|
@ -95,8 +95,9 @@ use cuprate_database::{
|
||||||
|
|
||||||
# fn main() -> Result<(), Box<dyn std::error::Error>> {
|
# fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
// Create a configuration for the database environment.
|
// Create a configuration for the database environment.
|
||||||
let db_dir = tempfile::tempdir()?;
|
let tmp_dir = tempfile::tempdir()?;
|
||||||
let config = ConfigBuilder::new(db_dir.path().to_path_buf()).build();
|
let db_dir = tmp_dir.path().to_owned();
|
||||||
|
let config = ConfigBuilder::new(db_dir.into()).build();
|
||||||
|
|
||||||
// Initialize the database environment.
|
// Initialize the database environment.
|
||||||
let env = ConcreteEnv::open(config)?;
|
let env = ConcreteEnv::open(config)?;
|
||||||
|
|
|
@ -186,10 +186,11 @@ impl Config {
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// use cuprate_database::{config::*, resize::*, DATABASE_DATA_FILENAME};
|
/// use cuprate_database::{config::*, resize::*, DATABASE_DATA_FILENAME};
|
||||||
///
|
///
|
||||||
/// let db_directory = tempfile::tempdir().unwrap();
|
/// let tmp_dir = tempfile::tempdir().unwrap();
|
||||||
/// let config = Config::new(db_directory.path().into());
|
/// 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().starts_with(db_directory));
|
||||||
/// assert!(config.db_file().ends_with(DATABASE_DATA_FILENAME));
|
/// assert!(config.db_file().ends_with(DATABASE_DATA_FILENAME));
|
||||||
/// assert_eq!(config.sync_mode, SyncMode::default());
|
/// assert_eq!(config.sync_mode, SyncMode::default());
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
|
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
//! let db_dir = tempfile::tempdir()?;
|
//! 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.
|
//! // Use the fastest sync mode.
|
||||||
//! .sync_mode(SyncMode::Fast)
|
//! .sync_mode(SyncMode::Fast)
|
||||||
//! // Build into `Config`
|
//! // Build into `Config`
|
||||||
|
|
Loading…
Reference in a new issue