pub struct RuntimeConfigSnapshot { /* private fields */ }Expand description
Effective configuration for a single running service: every registered key resolved to a concrete value plus the source it came from.
Implementations§
Source§impl RuntimeConfigSnapshot
impl RuntimeConfigSnapshot
Sourcepub fn resolve(
registry: &RuntimeConfigRegistry,
service_key: &str,
stored: &BTreeMap<(String, String), Value>,
) -> Self
pub fn resolve( registry: &RuntimeConfigRegistry, service_key: &str, stored: &BTreeMap<(String, String), Value>, ) -> Self
Resolve every descriptor for service_key against the stored rows.
stored maps (service_key, key) to the stored JSON value. Resolution
order per key: a row for this service, else a * row, else the default.
Stored values failing validation fall back to the default.
Sourcepub fn raw(&self, key: &str) -> Option<&Value>
pub fn raw(&self, key: &str) -> Option<&Value>
The raw effective value for a key, if registered.
Sourcepub fn source(&self, key: &str) -> Option<RuntimeConfigSource>
pub fn source(&self, key: &str) -> Option<RuntimeConfigSource>
The source of a key’s effective value, if registered.
Sourcepub fn get_value<T: DeserializeOwned>(&self, key: &str) -> AppResult<T>
pub fn get_value<T: DeserializeOwned>(&self, key: &str) -> AppResult<T>
Deserialize a single key into a typed value.
Sourcepub fn get<T: DeserializeOwned>(&self, prefix: &str) -> AppResult<T>
pub fn get<T: DeserializeOwned>(&self, prefix: &str) -> AppResult<T>
Build a typed struct whose fields are keys sharing prefix + ..
Example: prefix "identity" with key "identity.password_reset_ttl_minutes"
produces an object field password_reset_ttl_minutes.
Sourcepub fn entries(
&self,
) -> impl Iterator<Item = (&str, &Value, RuntimeConfigSource)>
pub fn entries( &self, ) -> impl Iterator<Item = (&str, &Value, RuntimeConfigSource)>
All resolved keys with their value and source, for the console values API.
Sourcepub fn with_overrides(
self,
overrides: &BTreeMap<String, (Value, RuntimeConfigSource)>,
) -> Self
pub fn with_overrides( self, overrides: &BTreeMap<String, (Value, RuntimeConfigSource)>, ) -> Self
Override specific keys’ resolved entries. Used to carry forward values that must not change after startup (e.g. restart-only config values).
Trait Implementations§
Source§impl Clone for RuntimeConfigSnapshot
impl Clone for RuntimeConfigSnapshot
Source§fn clone(&self) -> RuntimeConfigSnapshot
fn clone(&self) -> RuntimeConfigSnapshot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RuntimeConfigSnapshot
impl Debug for RuntimeConfigSnapshot
Source§impl Default for RuntimeConfigSnapshot
impl Default for RuntimeConfigSnapshot
Source§fn default() -> RuntimeConfigSnapshot
fn default() -> RuntimeConfigSnapshot
Auto Trait Implementations§
impl Freeze for RuntimeConfigSnapshot
impl RefUnwindSafe for RuntimeConfigSnapshot
impl Send for RuntimeConfigSnapshot
impl Sync for RuntimeConfigSnapshot
impl Unpin for RuntimeConfigSnapshot
impl UnsafeUnpin for RuntimeConfigSnapshot
impl UnwindSafe for RuntimeConfigSnapshot
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>
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