pub struct HotReloadManager { /* private fields */ }Expand description
Central coordinator for all hot-reload operations.
Holds one ReloadableConfig<IndexerConfig> per registered indexer ID,
and a watch channel per config so subscribers are notified on every
version bump.
Implementations§
Source§impl HotReloadManager
impl HotReloadManager
Sourcepub async fn register_config(
&self,
id: &str,
config: IndexerConfig,
) -> Arc<RwLock<ReloadableConfig<IndexerConfig>>>
pub async fn register_config( &self, id: &str, config: IndexerConfig, ) -> Arc<RwLock<ReloadableConfig<IndexerConfig>>>
Register a new indexer config under id.
Returns a shared handle to the ReloadableConfig so the caller can
read the current value cheaply without going through the manager.
Sourcepub async fn update_config(
&self,
id: &str,
new_config: IndexerConfig,
) -> Result<ReloadResult, IndexerError>
pub async fn update_config( &self, id: &str, new_config: IndexerConfig, ) -> Result<ReloadResult, IndexerError>
Apply new_config to the indexer identified by id.
The update is validated first; if validation fails the existing config
is left unchanged and an Err is returned.
Sourcepub async fn get_config(&self, id: &str) -> Option<IndexerConfig>
pub async fn get_config(&self, id: &str) -> Option<IndexerConfig>
Return a clone of the current IndexerConfig for id, or None if
id is not registered.
Sourcepub async fn get_version(&self, id: &str) -> Option<u64>
pub async fn get_version(&self, id: &str) -> Option<u64>
Return the current version number for id, or None if not registered.
Sourcepub async fn subscribe(&self, id: &str) -> Option<Receiver<u64>>
pub async fn subscribe(&self, id: &str) -> Option<Receiver<u64>>
Return a watch::Receiver that yields the new version on every reload.
Returns None if id is not registered.
Sourcepub async fn history(&self, id: &str) -> Vec<ReloadRecord>
pub async fn history(&self, id: &str) -> Vec<ReloadRecord>
Return the full reload history for id.