use directories::BaseDirs; use lazy_static::lazy_static; use std::path::PathBuf; use crate::models::{DLSiteManiax, RocksColumn}; const APP_DIR_NAME: &str = "sus_manager"; lazy_static! { static ref BASE_DIRS: BaseDirs = BaseDirs::new().unwrap(); pub static ref APP_CONFIG_DIR: PathBuf = BASE_DIRS.config_dir().to_path_buf().join(APP_DIR_NAME); pub static ref APP_DATA_DIR: PathBuf = BASE_DIRS.data_dir().to_path_buf().join(APP_DIR_NAME); pub static ref APP_CACHE_PATH: PathBuf = BASE_DIRS.cache_dir().to_path_buf().join(APP_DIR_NAME); pub static ref APP_CONIFG_FILE_PATH: PathBuf = APP_CONFIG_DIR.clone().join("config.json"); pub static ref APP_DB_DATA_DIR: PathBuf = APP_DATA_DIR.clone().join("db"); pub static ref DB_OPTIONS: rocksdb::Options = get_db_options(); pub static ref DB_CF_OPTIONS: rocksdb::Options = rocksdb::Options::default(); } lazy_static! { pub static ref DB_COLUMNS: Vec = vec![DLSiteManiax::get_column_name().to_string()]; } fn get_db_options() -> rocksdb::Options { let mut opts = rocksdb::Options::default(); opts.create_missing_column_families(true); opts.create_if_missing(true); opts.increase_parallelism(num_cpus::get() as i32); opts }