pub struct HotConfig<C> { /* private fields */ }Expand description
An atomically-swappable handle to the live config-as-data value the turn loop reads at turn-start.
Clone to share the same underlying cell: a reader (the turn loop, per turn)
and a writer (a verified hot reload) hold clones and operate on one value.
HotConfig::current is the turn-start read; HotConfig::install is the
swap. A swap is visible only to reads that begin after it, so an in-flight
turn is never disturbed.
Implementations§
Source§impl<C> HotConfig<C>
impl<C> HotConfig<C>
Sourcepub fn current(&self) -> Arc<C>
pub fn current(&self) -> Arc<C>
The live config-as-data value, read at turn-start.
The returned Arc is the calling turn’s pinned snapshot: a later
HotConfig::install swaps the cell, but this owned handle keeps
pointing at the value that was live when the turn began. Read it once, at
the start of a turn, and thread that snapshot through the rest of the
turn.
Sourcepub fn install(&self, next: Arc<C>)
pub fn install(&self, next: Arc<C>)
Swap the live config-as-data value.
The swap is atomic and lock-free. Turns that already read
HotConfig::current keep their snapshot; the next turn to read sees
next.
Trait Implementations§
Auto Trait Implementations§
impl<C> Freeze for HotConfig<C>
impl<C> RefUnwindSafe for HotConfig<C>where
C: RefUnwindSafe,
impl<C> Send for HotConfig<C>
impl<C> Sync for HotConfig<C>
impl<C> Unpin for HotConfig<C>
impl<C> UnsafeUnpin for HotConfig<C>
impl<C> UnwindSafe for HotConfig<C>where
C: RefUnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> 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::Request