mirror of
https://github.com/hinto-janai/cuprate.git
synced 2025-01-21 18:24:31 +00:00
fix test 2
This commit is contained in:
parent
cf34a8d2be
commit
65223dc175
2 changed files with 15 additions and 17 deletions
|
@ -159,9 +159,10 @@ impl ConfigBuilder {
|
|||
/// Good default for testing, and resource-available machines.
|
||||
#[must_use]
|
||||
pub fn fast(mut self) -> Self {
|
||||
self.db_config =
|
||||
cuprate_database::config::ConfigBuilder::new(Cow::Borrowed(&*CUPRATE_BLOCKCHAIN_DIR))
|
||||
.fast();
|
||||
self.db_config = cuprate_database::config::ConfigBuilder::new(Cow::Owned(
|
||||
path_with_network(&CUPRATE_BLOCKCHAIN_DIR, self.network),
|
||||
))
|
||||
.fast();
|
||||
|
||||
self.reader_threads = Some(ReaderThreads::OnePerThread);
|
||||
self
|
||||
|
@ -173,9 +174,10 @@ impl ConfigBuilder {
|
|||
/// Good default for resource-limited machines, e.g. a cheap VPS.
|
||||
#[must_use]
|
||||
pub fn low_power(mut self) -> Self {
|
||||
self.db_config =
|
||||
cuprate_database::config::ConfigBuilder::new(Cow::Borrowed(&*CUPRATE_BLOCKCHAIN_DIR))
|
||||
.low_power();
|
||||
self.db_config = cuprate_database::config::ConfigBuilder::new(Cow::Owned(
|
||||
path_with_network(&CUPRATE_BLOCKCHAIN_DIR, self.network),
|
||||
))
|
||||
.low_power();
|
||||
|
||||
self.reader_threads = Some(ReaderThreads::One);
|
||||
self
|
||||
|
@ -218,7 +220,7 @@ impl Config {
|
|||
/// Create a new [`Config`] with sane default settings.
|
||||
///
|
||||
/// The [`cuprate_database::config::Config::db_directory`]
|
||||
/// will be set to [`CUPRATE_BLOCKCHAIN_DIR`].
|
||||
/// will be set to [`CUPRATE_BLOCKCHAIN_DIR`] joined with [`Network::Mainnet`].
|
||||
///
|
||||
/// All other values will be [`Default::default`].
|
||||
///
|
||||
|
@ -230,13 +232,13 @@ impl Config {
|
|||
/// resize::ResizeAlgorithm,
|
||||
/// DATABASE_DATA_FILENAME,
|
||||
/// };
|
||||
/// use cuprate_helper::fs::*;
|
||||
/// use cuprate_helper::{fs::*, network::Network};
|
||||
///
|
||||
/// use cuprate_blockchain::config::*;
|
||||
///
|
||||
/// let config = Config::new();
|
||||
///
|
||||
/// assert_eq!(config.db_config.db_directory(), &*CUPRATE_BLOCKCHAIN_DIR);
|
||||
/// assert_eq!(config.db_config.db_directory().as_ref(), path_with_network(&CUPRATE_BLOCKCHAIN_DIR, Network::Mainnet).as_path());
|
||||
/// assert!(config.db_config.db_file().starts_with(&*CUPRATE_BLOCKCHAIN_DIR));
|
||||
/// assert!(config.db_config.db_file().ends_with(DATABASE_DATA_FILENAME));
|
||||
/// assert_eq!(config.db_config.sync_mode, SyncMode::default());
|
||||
|
|
|
@ -201,7 +201,7 @@ impl Config {
|
|||
/// Create a new [`Config`] with sane default settings.
|
||||
///
|
||||
/// The [`DbConfig::db_directory`]
|
||||
/// will be set to [`CUPRATE_TXPOOL_DIR`].
|
||||
/// will be set to [`CUPRATE_TXPOOL_DIR`] joined with [`Network::Mainnet`].
|
||||
///
|
||||
/// All other values will be [`Default::default`].
|
||||
///
|
||||
|
@ -214,13 +214,13 @@ impl Config {
|
|||
/// DATABASE_DATA_FILENAME,
|
||||
/// };
|
||||
/// use cuprate_database_service::ReaderThreads;
|
||||
/// use cuprate_helper::fs::*;
|
||||
/// use cuprate_helper::{fs::*, network::Network};
|
||||
///
|
||||
/// use cuprate_txpool::Config;
|
||||
///
|
||||
/// let config = Config::new();
|
||||
///
|
||||
/// assert_eq!(config.db_config.db_directory(), &*CUPRATE_TXPOOL_DIR);
|
||||
/// assert_eq!(config.db_config.db_directory(), path_with_network(&CUPRATE_TXPOOL_DIR, Network::Mainnet).as_path());
|
||||
/// assert!(config.db_config.db_file().starts_with(&*CUPRATE_TXPOOL_DIR));
|
||||
/// assert!(config.db_config.db_file().ends_with(DATABASE_DATA_FILENAME));
|
||||
/// assert_eq!(config.db_config.sync_mode, SyncMode::default());
|
||||
|
@ -228,11 +228,7 @@ impl Config {
|
|||
/// assert_eq!(config.reader_threads, ReaderThreads::default());
|
||||
/// ```
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
db_config: DbConfig::new(Cow::Borrowed(&*CUPRATE_TXPOOL_DIR)),
|
||||
reader_threads: ReaderThreads::default(),
|
||||
max_txpool_weight: 0,
|
||||
}
|
||||
ConfigBuilder::new().build()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue