pub struct ConfigHotReloader { /* private fields */ }
Expand description
Configuration hot reloader
Implementations§
Source§impl ConfigHotReloader
impl ConfigHotReloader
Sourcepub fn new(
config: McpServerConfig,
config_path: PathBuf,
reload_interval: Duration,
) -> Result<Self>
pub fn new( config: McpServerConfig, config_path: PathBuf, reload_interval: Duration, ) -> Result<Self>
Sourcepub fn with_default_settings(config_path: PathBuf) -> Result<Self>
pub fn with_default_settings(config_path: PathBuf) -> Result<Self>
Sourcepub async fn get_config(&self) -> McpServerConfig
pub async fn get_config(&self) -> McpServerConfig
Get the current configuration
Sourcepub async fn update_config(&self, new_config: McpServerConfig) -> Result<()>
pub async fn update_config(&self, new_config: McpServerConfig) -> Result<()>
Sourcepub fn subscribe_to_changes(&self) -> Receiver<McpServerConfig>
pub fn subscribe_to_changes(&self) -> Receiver<McpServerConfig>
Get a receiver for configuration change notifications
Sourcepub fn set_enabled(&mut self, enabled: bool)
pub fn set_enabled(&mut self, enabled: bool)
Enable or disable hot reloading
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if hot reloading is enabled
Sourcepub fn start(&self) -> Result<()>
pub fn start(&self) -> Result<()>
Start the hot reloader task
This will spawn a background task that periodically checks for configuration changes and reloads the configuration if changes are detected.
§Errors
Returns an error if the configuration cannot be loaded or if there are issues with the file system operations.
Sourcepub async fn reload_now(&self) -> Result<bool>
pub async fn reload_now(&self) -> Result<bool>
Manually trigger a configuration reload
§Errors
Returns an error if the configuration cannot be reloaded
Sourcepub fn config_path(&self) -> &PathBuf
pub fn config_path(&self) -> &PathBuf
Get the configuration file path being watched
Sourcepub fn reload_interval(&self) -> Duration
pub fn reload_interval(&self) -> Duration
Get the reload interval
Sourcepub fn set_reload_interval(&mut self, interval: Duration)
pub fn set_reload_interval(&mut self, interval: Duration)
Set the reload interval
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConfigHotReloader
impl !RefUnwindSafe for ConfigHotReloader
impl Send for ConfigHotReloader
impl Sync for ConfigHotReloader
impl Unpin for ConfigHotReloader
impl !UnwindSafe for ConfigHotReloader
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more