use std::sync::OnceLock;
use dashmap::DashMap;
fn store() -> &'static DashMap<String, bool> {
static STORE: OnceLock<DashMap<String, bool>> = OnceLock::new();
STORE.get_or_init(DashMap::new)
}
pub fn set(name: &str, value: bool) -> bool {
store().insert(name.to_string(), value).unwrap_or(false)
}
pub fn get(name: &str) -> bool {
store().get(name).map(|e| *e.value()).unwrap_or(false)
}
pub fn all() -> Vec<(String, bool)> {
let mut pairs: Vec<(String, bool)> = store()
.iter()
.map(|e| (e.key().clone(), *e.value()))
.collect();
pairs.sort_by(|a, b| a.0.cmp(&b.0));
pairs
}
pub fn skip_tier_for_retrieval(tier: &str) -> bool {
get(&format!("SKIP_{}_FOR_RETRIEVAL", tier.to_uppercase()))
}
pub fn skip_tier_for_etl(tier: &str) -> bool {
get(&format!("SKIP_{}_FOR_ETL", tier.to_uppercase()))
}