mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-21 03:46:37 +00:00
refactor(config): remove legacy model re-export (#3357)
This commit is contained in:
@@ -34,13 +34,11 @@ use rustfs_config::notify::{
|
||||
NOTIFY_POSTGRES_SUB_SYS, NOTIFY_PULSAR_SUB_SYS, NOTIFY_REDIS_SUB_SYS, NOTIFY_WEBHOOK_SUB_SYS,
|
||||
};
|
||||
use rustfs_config::oidc::IDENTITY_OPENID_SUB_SYS;
|
||||
use rustfs_config::server_config::{Config, register_default_kvs};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::LazyLock;
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
// RUSTFS_COMPAT_TODO(CFG-004): keep old rustfs_ecstore::config model import paths while server-config model consumers migrate. Remove after all consumers import Config, KV, KVS, DEFAULT_KVS, and register_default_kvs from rustfs_config::server_config.
|
||||
pub use rustfs_config::server_config::{Config, DEFAULT_KVS, KV, KVS, register_default_kvs};
|
||||
|
||||
pub static GLOBAL_STORAGE_CLASS: LazyLock<RwLock<storageclass::Config>> =
|
||||
LazyLock::new(|| RwLock::new(storageclass::Config::default()));
|
||||
pub static GLOBAL_SERVER_CONFIG: LazyLock<RwLock<Option<Config>>> = LazyLock::new(|| RwLock::new(None));
|
||||
@@ -134,6 +132,7 @@ pub fn init() {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use rustfs_config::server_config::KVS;
|
||||
use rustfs_config::{
|
||||
DEFAULT_DELIMITER, DEFAULT_HEAL_BITROT_CYCLE_SECS, DEFAULT_SCANNER_SPEED, HEAL_BITROT_CYCLE, SCANNER_CYCLE_MAX_OBJECTS,
|
||||
SCANNER_DELAY, SCANNER_MAX_WAIT, SCANNER_SPEED, SCANNER_SUB_SYS,
|
||||
@@ -175,23 +174,4 @@ mod tests {
|
||||
|
||||
assert_eq!(heal_kvs.get(HEAL_BITROT_CYCLE), DEFAULT_HEAL_BITROT_CYCLE_SECS.to_string());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn old_config_model_path_reexports_moved_types() {
|
||||
let mut kvs = crate::config::KVS::new();
|
||||
kvs.insert("key".to_string(), "value".to_string());
|
||||
let cfg = crate::config::Config(HashMap::from([(
|
||||
"subsys".to_string(),
|
||||
HashMap::from([(DEFAULT_DELIMITER.to_string(), kvs)]),
|
||||
)]));
|
||||
let moved_cfg: rustfs_config::server_config::Config = cfg;
|
||||
|
||||
assert_eq!(
|
||||
moved_cfg
|
||||
.get_value("subsys", DEFAULT_DELIMITER)
|
||||
.expect("subsys should exist")
|
||||
.get("key"),
|
||||
"value"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user