pub struct Registry { /* private fields */ }Expand description
Ordered component registry.
Components start in registration order and stop in reverse registration order, ensuring dependants shut down before their dependencies.
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn with_config(config: RegistryConfig) -> Self
pub fn with_config(config: RegistryConfig) -> Self
Create a registry with custom RegistryConfig.
Sourcepub fn register(&mut self, component: Arc<dyn Component>)
pub fn register(&mut self, component: Arc<dyn Component>)
Register a component. Registration order determines startup order.
Sourcepub async fn start_all(&self) -> AppResult<()>
pub async fn start_all(&self) -> AppResult<()>
Start all startable components in registration order.
Sourcepub async fn start_all_concurrent(
&self,
cancel: CancellationToken,
) -> AppResult<()>
pub async fn start_all_concurrent( &self, cancel: CancellationToken, ) -> AppResult<()>
Start all components concurrently, limited by RegistryConfig::concurrency.
Sourcepub async fn stop_all(&self) -> AppResult<()>
pub async fn stop_all(&self) -> AppResult<()>
Stop all running components in reverse registration order.
Sourcepub async fn stop_all_detailed(&self) -> Vec<StopResult>
pub async fn stop_all_detailed(&self) -> Vec<StopResult>
Stop all running components in reverse registration order with per-component results.
Sourcepub fn health_all(&self) -> Vec<Health>
pub fn health_all(&self) -> Vec<Health>
Collect health for all registered components without holding the registry lock while component health is evaluated.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Registry
impl !UnwindSafe for Registry
impl Freeze for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnsafeUnpin for Registry
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
Mutably borrows from an owned value. Read more