use crate::configuration::NotificationBackendSettings;
#[derive(Debug, Clone)]
pub struct InMemoryConfig {
pub max_history_per_topic: usize,
pub max_topics: usize,
pub enable_metrics: bool,
}
impl InMemoryConfig {
pub fn from_backend_settings(settings: &NotificationBackendSettings) -> Self {
let in_memory_settings = settings.in_memory.as_ref();
Self {
max_history_per_topic: in_memory_settings
.and_then(|im| im.max_history_per_topic)
.unwrap_or(1), max_topics: in_memory_settings
.and_then(|im| im.max_topics)
.unwrap_or(10000), enable_metrics: in_memory_settings
.and_then(|im| im.enable_metrics)
.unwrap_or(false), }
}
}