pub struct AsyncRuntimeConfig { /* private fields */ }Expand description
Async runtime configuration cache.
This type uses tokio::sync::RwLock and is intended for async-first
services that want to load and query runtime configuration through async
boundaries. Services with synchronous hot read paths should use
SyncRuntimeConfig instead.
Implementations§
Source§impl AsyncRuntimeConfig
impl AsyncRuntimeConfig
Sourcepub async fn reload<S>(&self, store: &S) -> Result<Vec<RuntimeConfigChange>>where
S: AsyncConfigStore + ?Sized,
pub async fn reload<S>(&self, store: &S) -> Result<Vec<RuntimeConfigChange>>where
S: AsyncConfigStore + ?Sized,
Reloads all values from store and returns the diff.
Restart-only rows keep their in-process record when the key already
exists (value and flags stay until restart), mirroring Self::apply;
the diff does not report those keys as changed. Removals are applied
immediately, matching Self::remove.
Sourcepub async fn snapshot(&self) -> AsyncConfigSnapshot
pub async fn snapshot(&self) -> AsyncConfigSnapshot
Returns a cloned snapshot for lock-free derived-state processing.
Sourcepub async fn get_model(&self, key: &str) -> Option<StoredConfig>
pub async fn get_model(&self, key: &str) -> Option<StoredConfig>
Returns the stored model for key.
Sourcepub async fn apply(&self, config: StoredConfig) -> Option<RuntimeConfigChange>
pub async fn apply(&self, config: StoredConfig) -> Option<RuntimeConfigChange>
Applies one row to the snapshot.
If the incoming row requires restart and the key already exists, the update is ignored to preserve the in-process value until restart.
Sourcepub async fn remove(&self, key: &str) -> Option<RuntimeConfigChange>
pub async fn remove(&self, key: &str) -> Option<RuntimeConfigChange>
Removes one key from the snapshot.
Trait Implementations§
Source§impl Debug for AsyncRuntimeConfig
impl Debug for AsyncRuntimeConfig
Source§impl Default for AsyncRuntimeConfig
impl Default for AsyncRuntimeConfig
Source§fn default() -> AsyncRuntimeConfig
fn default() -> AsyncRuntimeConfig
Auto Trait Implementations§
impl !Freeze for AsyncRuntimeConfig
impl !RefUnwindSafe for AsyncRuntimeConfig
impl Send for AsyncRuntimeConfig
impl Sync for AsyncRuntimeConfig
impl Unpin for AsyncRuntimeConfig
impl UnsafeUnpin for AsyncRuntimeConfig
impl !UnwindSafe for AsyncRuntimeConfig
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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