pub struct ReloadableConfig { /* private fields */ }Expand description
Wrapper around ServerConfig that supports hot-reloading
Uses Arc<RwLock<ServerConfig>> so that readers can access the config
concurrently, and reloads atomically swap the inner config.
Implementations§
Source§impl ReloadableConfig
impl ReloadableConfig
Sourcepub fn new(config: ServerConfig) -> Self
pub fn new(config: ServerConfig) -> Self
Create a new reloadable config from an existing config
Sourcepub fn from_file(path: &str) -> ConfigResult<Self>
pub fn from_file(path: &str) -> ConfigResult<Self>
Create a new reloadable config from a file
Sourcepub fn set_config_path(&self, path: PathBuf)
pub fn set_config_path(&self, path: PathBuf)
Set the config file path (for future reloads)
Sourcepub fn read(&self) -> RwLockReadGuard<'_, ServerConfig>
pub fn read(&self) -> RwLockReadGuard<'_, ServerConfig>
Get a read guard to the current configuration
Sourcepub fn snapshot(&self) -> ServerConfig
pub fn snapshot(&self) -> ServerConfig
Get a clone of the current configuration
Sourcepub fn reload_from_file(&self, path: &str) -> ConfigResult<ReloadReport>
pub fn reload_from_file(&self, path: &str) -> ConfigResult<ReloadReport>
Reload configuration from a file path
Parses the new config, validates it, computes a diff, and applies only the reloadable sections. Non-reloadable changes are skipped with warnings. If validation fails, the old config is preserved.
Sourcepub fn reload_from_stored_path(&self) -> ConfigResult<ReloadReport>
pub fn reload_from_stored_path(&self) -> ConfigResult<ReloadReport>
Reload from the stored config path (used by SIGHUP handler)
Sourcepub fn manual_reload(&self) -> ConfigResult<ReloadReport>
pub fn manual_reload(&self) -> ConfigResult<ReloadReport>
Manual reload trigger (useful on non-Unix platforms or for testing)
Trait Implementations§
Source§impl Clone for ReloadableConfig
impl Clone for ReloadableConfig
Source§fn clone(&self) -> ReloadableConfig
fn clone(&self) -> ReloadableConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ReloadableConfig
impl !RefUnwindSafe for ReloadableConfig
impl Send for ReloadableConfig
impl Sync for ReloadableConfig
impl Unpin for ReloadableConfig
impl UnsafeUnpin for ReloadableConfig
impl !UnwindSafe for ReloadableConfig
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.