pub struct ConfigManager { /* private fields */ }Expand description
The main configuration manager
Implementations§
Source§impl ConfigManager
impl ConfigManager
Sourcepub fn add_source(&mut self, source: impl ConfigSource + 'static, priority: u32)
pub fn add_source(&mut self, source: impl ConfigSource + 'static, priority: u32)
Add a configuration source with priority (higher number = higher priority)
Sourcepub fn set_validator(&mut self, validator: SchemaValidator)
pub fn set_validator(&mut self, validator: SchemaValidator)
Set the schema validator
Sourcepub async fn initialize(&self) -> Result<()>
pub async fn initialize(&self) -> Result<()>
Initialize the configuration manager by loading from all sources
Sourcepub async fn get<T>(&self, key: &str) -> Result<T>where
T: for<'de> Deserialize<'de>,
pub async fn get<T>(&self, key: &str) -> Result<T>where
T: for<'de> Deserialize<'de>,
Get a typed configuration value
Sourcepub async fn get_value(&self, key: &str) -> Result<ConfigValue>
pub async fn get_value(&self, key: &str) -> Result<ConfigValue>
Get a configuration value
Sourcepub async fn get_value_for_node(
&self,
key: &str,
node_id: &str,
) -> Result<ConfigValue>
pub async fn get_value_for_node( &self, key: &str, node_id: &str, ) -> Result<ConfigValue>
Get a configuration value for a specific node
Sourcepub async fn set_value(&self, key: &str, value: ConfigValue) -> Result<()>
pub async fn set_value(&self, key: &str, value: ConfigValue) -> Result<()>
Set a configuration value
Sourcepub async fn set_value_for_cluster(
&self,
key: &str,
value: ConfigValue,
) -> Result<()>
pub async fn set_value_for_cluster( &self, key: &str, value: ConfigValue, ) -> Result<()>
Set a configuration value for the entire cluster
Sourcepub async fn is_feature_enabled(&self, flag_name: &str) -> Result<bool>
pub async fn is_feature_enabled(&self, flag_name: &str) -> Result<bool>
Check if a feature flag is enabled
Sourcepub async fn watch(&self, key_pattern: &str) -> Result<ConfigWatcher>
pub async fn watch(&self, key_pattern: &str) -> Result<ConfigWatcher>
Watch for configuration changes
Sourcepub async fn save_to_file(&self, path: &str) -> Result<()>
pub async fn save_to_file(&self, path: &str) -> Result<()>
Save current configuration to a file
Sourcepub async fn get_history(
&self,
key: &str,
limit: usize,
) -> Result<Vec<HistoryEntry>>
pub async fn get_history( &self, key: &str, limit: usize, ) -> Result<Vec<HistoryEntry>>
Get configuration history for a key
Trait Implementations§
Source§impl Default for ConfigManager
impl Default for ConfigManager
Auto Trait Implementations§
impl Freeze for ConfigManager
impl !RefUnwindSafe for ConfigManager
impl Send for ConfigManager
impl Sync for ConfigManager
impl Unpin for ConfigManager
impl !UnwindSafe for ConfigManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more