pub struct ConfigWatcher { /* private fields */ }Expand description
Configuration watcher for hot-reload support
Implementations§
Source§impl ConfigWatcher
impl ConfigWatcher
Sourcepub fn new<P: AsRef<Path>>(
config_dir: P,
tool_registry: Arc<ToolRegistry>,
) -> Self
pub fn new<P: AsRef<Path>>( config_dir: P, tool_registry: Arc<ToolRegistry>, ) -> Self
Creates a new configuration watcher
§Arguments
config_dir- Directory to watch for configuration changestool_registry- Tool registry to update on configuration changes
Sourcepub async fn load_initial_config(&self) -> Result<()>
pub async fn load_initial_config(&self) -> Result<()>
Loads initial configuration from the configuration directory
Sourcepub async fn watch_for_changes(&self) -> Result<()>
pub async fn watch_for_changes(&self) -> Result<()>
Detects configuration file changes
This method should be run in a background task to continuously monitor for changes.
Sourcepub async fn get_current_config(&self) -> MCPConfig
pub async fn get_current_config(&self) -> MCPConfig
Gets the current configuration
Sourcepub async fn reload_config(&self) -> Result<()>
pub async fn reload_config(&self) -> Result<()>
Manually reloads configuration
Sourcepub async fn validate_new_config<P: AsRef<Path>>(
&self,
config_path: P,
) -> Result<MCPConfig>
pub async fn validate_new_config<P: AsRef<Path>>( &self, config_path: P, ) -> Result<MCPConfig>
Validates new configuration before applying
Sourcepub fn config_dir(&self) -> &Path
pub fn config_dir(&self) -> &Path
Gets the configuration directory
Sourcepub fn set_config_dir<P: AsRef<Path>>(&mut self, dir: P)
pub fn set_config_dir<P: AsRef<Path>>(&mut self, dir: P)
Sets the configuration directory
Trait Implementations§
Source§impl Clone for ConfigWatcher
impl Clone for ConfigWatcher
Source§fn clone(&self) -> ConfigWatcher
fn clone(&self) -> ConfigWatcher
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ConfigWatcher
impl !RefUnwindSafe for ConfigWatcher
impl Send for ConfigWatcher
impl Sync for ConfigWatcher
impl Unpin for ConfigWatcher
impl !UnwindSafe for ConfigWatcher
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