pub struct ConfigSyncRuntime { /* private fields */ }Expand description
Namespaced runtime handle for cross-process config synchronization.
This type is the product-facing boundary for config sync. It keeps the namespace, runtime identity, backend notifier, publish helper, and subscription worker wiring together so product crates only provide their authoritative reload callback.
Implementations§
Source§impl ConfigSyncRuntime
impl ConfigSyncRuntime
Sourcepub fn new(
namespace: impl Into<String>,
runtime_id: impl Into<String>,
notifier: impl Into<SharedConfigChangeNotifier>,
) -> Self
pub fn new( namespace: impl Into<String>, runtime_id: impl Into<String>, notifier: impl Into<SharedConfigChangeNotifier>, ) -> Self
Creates an enabled runtime from a namespace, runtime ID, and notifier.
Sourcepub fn disabled(namespace: impl Into<String>) -> Self
pub fn disabled(namespace: impl Into<String>) -> Self
Creates a disabled runtime with a generated runtime ID.
Sourcepub fn disabled_with_runtime_id(
namespace: impl Into<String>,
runtime_id: impl Into<String>,
) -> Self
pub fn disabled_with_runtime_id( namespace: impl Into<String>, runtime_id: impl Into<String>, ) -> Self
Creates a disabled runtime with an explicit runtime ID.
Sourcepub fn disabled_for_test(namespace: impl Into<String>) -> Self
pub fn disabled_for_test(namespace: impl Into<String>) -> Self
Creates a disabled runtime for tests and single-process defaults.
Sourcepub fn with_notifier_for_test(
namespace: impl Into<String>,
runtime_id: impl Into<String>,
notifier: impl Into<SharedConfigChangeNotifier>,
) -> Self
pub fn with_notifier_for_test( namespace: impl Into<String>, runtime_id: impl Into<String>, notifier: impl Into<SharedConfigChangeNotifier>, ) -> Self
Creates an enabled runtime from an explicit notifier for tests.
Sourcepub fn namespace(&self) -> &str
pub fn namespace(&self) -> &str
Returns the product namespace this runtime accepts and publishes.
Sourcepub fn runtime_id(&self) -> &str
pub fn runtime_id(&self) -> &str
Returns the process runtime ID.
Sourcepub fn notifier(&self) -> Option<&SharedConfigChangeNotifier>
pub fn notifier(&self) -> Option<&SharedConfigChangeNotifier>
Returns the configured notifier, if cross-process sync is enabled.
Sourcepub fn worker_config(&self) -> ConfigReloadWorkerConfig
pub fn worker_config(&self) -> ConfigReloadWorkerConfig
Converts this runtime into the reload-worker filter configuration.
Sourcepub async fn publish_reload(
&self,
keys: impl IntoIterator<Item = impl Into<String>>,
source: ConfigNotificationSource,
) -> Result<()>
pub async fn publish_reload( &self, keys: impl IntoIterator<Item = impl Into<String>>, source: ConfigNotificationSource, ) -> Result<()>
Publishes a reload hint after a local config mutation.
Sourcepub async fn run_reload_subscription<F, Fut>(
&self,
shutdown: CancellationToken,
reload: F,
) -> Result<()>
pub async fn run_reload_subscription<F, Fut>( &self, shutdown: CancellationToken, reload: F, ) -> Result<()>
Runs this runtime’s reload subscription worker until shutdown.
Disabled runtimes simply wait for shutdown, which lets callers spawn the same task unconditionally if that is more convenient.
Sourcepub async fn run_reload_subscription_with_observer<F, Fut>(
&self,
shutdown: CancellationToken,
reload: F,
observer: Option<&dyn ConfigReloadObserver>,
) -> Result<()>
pub async fn run_reload_subscription_with_observer<F, Fut>( &self, shutdown: CancellationToken, reload: F, observer: Option<&dyn ConfigReloadObserver>, ) -> Result<()>
Runs this runtime’s reload subscription worker and reports observations.
Sourcepub async fn run_reload_subscription_with_reconcile<R, RFut, F, Fut>(
&self,
shutdown: CancellationToken,
reconcile: R,
reload: F,
) -> Result<()>
pub async fn run_reload_subscription_with_reconcile<R, RFut, F, Fut>( &self, shutdown: CancellationToken, reconcile: R, reload: F, ) -> Result<()>
Runs a reconnecting subscription with an authoritative reconcile callback.
reconcile runs after each successful subscription. Product code should
reload its full snapshot and invalidate all derived configuration caches.
Sourcepub async fn run_reload_subscription_with_reconcile_and_observers<R, RFut, F, Fut>(
&self,
shutdown: CancellationToken,
reconcile: R,
reload: F,
reload_observer: Option<&dyn ConfigReloadObserver>,
connection_observer: Option<&dyn ConfigSyncConnectionObserver>,
) -> Result<()>
pub async fn run_reload_subscription_with_reconcile_and_observers<R, RFut, F, Fut>( &self, shutdown: CancellationToken, reconcile: R, reload: F, reload_observer: Option<&dyn ConfigReloadObserver>, connection_observer: Option<&dyn ConfigSyncConnectionObserver>, ) -> Result<()>
Runs a reconnecting subscription and reports reload and connection observations.
Trait Implementations§
Source§impl Clone for ConfigSyncRuntime
impl Clone for ConfigSyncRuntime
Source§fn clone(&self) -> ConfigSyncRuntime
fn clone(&self) -> ConfigSyncRuntime
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ConfigSyncRuntime
impl !RefUnwindSafe for ConfigSyncRuntime
impl Send for ConfigSyncRuntime
impl Sync for ConfigSyncRuntime
impl Unpin for ConfigSyncRuntime
impl UnsafeUnpin for ConfigSyncRuntime
impl !UnwindSafe for ConfigSyncRuntime
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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