pub struct HotReloadRegistry { /* private fields */ }Expand description
Hot-reloadable provider registry.
Construct with HotReloadRegistry::start; access the current
registry via HotReloadRegistry::current. The atomic load
is constant-time and lock-free; the rebuild path takes a write
lock briefly (only for the swap, not for the disk read), so
concurrent reads are never blocked.
Implementations§
Source§impl HotReloadRegistry
impl HotReloadRegistry
Sourcepub fn start(
rules_dir: impl Into<PathBuf>,
poll_interval: Duration,
) -> Result<Arc<Self>>
pub fn start( rules_dir: impl Into<PathBuf>, poll_interval: Duration, ) -> Result<Arc<Self>>
Start watching rules_dir for changes. Constructs the initial
registry from the bundled built-ins + every *.toml file in
rules_dir. Spawns a background task that polls every
poll_interval (default 2s); the task lives for the lifetime
of the program (tied to the returned Arc).
Sourcepub fn current(&self) -> Arc<ProviderRegistry>
pub fn current(&self) -> Arc<ProviderRegistry>
Borrow the current registry. Constant-time + lock-free for the reader side except for the very brief read-lock acquisition (microseconds).
Sourcepub fn reload_count(&self) -> u64
pub fn reload_count(&self) -> u64
How many times we’ve successfully reloaded the registry.
Reads use Ordering::Relaxed, operators sample this
from a metrics endpoint, exact ordering doesn’t matter.
Auto Trait Implementations§
impl !Freeze for HotReloadRegistry
impl RefUnwindSafe for HotReloadRegistry
impl Send for HotReloadRegistry
impl Sync for HotReloadRegistry
impl Unpin for HotReloadRegistry
impl UnsafeUnpin for HotReloadRegistry
impl UnwindSafe for HotReloadRegistry
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 more