pub struct TargetTlsRuntimeState<M> {
pub current: ArcSwap<TargetTlsPublishedState<M>>,
pub last_good: ArcSwap<TargetTlsPublishedState<M>>,
pub last_attempt_unix_ms: AtomicU64,
pub last_success_unix_ms: AtomicU64,
pub last_error: RwLock<Option<String>>,
pub inputs: TargetTlsInputSet,
pub reload_lock: Mutex<()>,
}Expand description
Per-target TLS reload runtime state. Owns the current published material and tracks timestamps and the last error for observability.
Fields§
§current: ArcSwap<TargetTlsPublishedState<M>>The currently active TLS material generation.
last_good: ArcSwap<TargetTlsPublishedState<M>>The last known-good generation (never overwritten by a failed reload).
last_attempt_unix_ms: AtomicU64Unix-millis timestamp of the last reload attempt (success or failure).
last_success_unix_ms: AtomicU64Unix-millis timestamp of the last successful reload.
last_error: RwLock<Option<String>>Last reload error message, if any.
inputs: TargetTlsInputSetThe TLS file paths this state watches.
reload_lock: Mutex<()>Serializes reload cycles for this target. Without it a force_reload
and a poll-loop tick could interleave, producing duplicate generations
or publishing an older material over a newer one.
Implementations§
Source§impl<M> TargetTlsRuntimeState<M>
impl<M> TargetTlsRuntimeState<M>
Sourcepub fn new(
initial: Arc<TargetTlsPublishedState<M>>,
inputs: TargetTlsInputSet,
) -> Self
pub fn new( initial: Arc<TargetTlsPublishedState<M>>, inputs: TargetTlsInputSet, ) -> Self
Creates a new runtime state with the given initial published state.
Sourcepub fn current_generation(&self) -> TargetTlsGeneration
pub fn current_generation(&self) -> TargetTlsGeneration
Returns the generation of the currently active material.
Sourcepub fn bump_generation(&self) -> TargetTlsGeneration
pub fn bump_generation(&self) -> TargetTlsGeneration
Atomically bumps and returns the next generation.
Sourcepub fn mark_attempt(&self, unix_ms: u64)
pub fn mark_attempt(&self, unix_ms: u64)
Records the timestamp of a reload attempt.
Sourcepub fn mark_success(&self, unix_ms: u64)
pub fn mark_success(&self, unix_ms: u64)
Records the timestamp of a successful reload.
Sourcepub fn last_attempt_unix_ms(&self) -> u64
pub fn last_attempt_unix_ms(&self) -> u64
Returns the last attempt timestamp.
Sourcepub fn last_success_unix_ms(&self) -> u64
pub fn last_success_unix_ms(&self) -> u64
Returns the last success timestamp.
Auto Trait Implementations§
impl<M> !Freeze for TargetTlsRuntimeState<M>
impl<M> !RefUnwindSafe for TargetTlsRuntimeState<M>
impl<M> Send for TargetTlsRuntimeState<M>
impl<M> Sync for TargetTlsRuntimeState<M>
impl<M> Unpin for TargetTlsRuntimeState<M>
impl<M> UnsafeUnpin for TargetTlsRuntimeState<M>
impl<M> UnwindSafe for TargetTlsRuntimeState<M>
Blanket Implementations§
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
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 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::Request