pub struct WorkloadComponent { /* private fields */ }Expand description
A lifecycle-managed workload component.
On start it builds the configured backend from the injected registry
and probes it with a health check
so an unreachable backend fails startup rather than reporting healthy;
on stop it releases the manager.
When WorkloadConfig::enabled is false the component is a healthy no-op
and never touches the registry.
Implementations§
Source§impl WorkloadComponent
impl WorkloadComponent
Sourcepub fn new(config: WorkloadConfig) -> Self
pub fn new(config: WorkloadConfig) -> Self
Create a component with an empty provider registry.
Useful when the component is disabled;
register providers via WorkloadComponent::with_registry to run an enabled backend.
Sourcepub fn with_registry(
config: WorkloadConfig,
providers: WorkloadRegistry,
) -> Self
pub fn with_registry( config: WorkloadConfig, providers: WorkloadRegistry, ) -> Self
Create a component with an explicit provider registry.
Trait Implementations§
Source§impl Component for WorkloadComponent
impl Component for WorkloadComponent
Source§fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = AppResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = AppResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start the component. Read more
Auto Trait Implementations§
impl !Freeze for WorkloadComponent
impl !RefUnwindSafe for WorkloadComponent
impl !UnwindSafe for WorkloadComponent
impl Send for WorkloadComponent
impl Sync for WorkloadComponent
impl Unpin for WorkloadComponent
impl UnsafeUnpin for WorkloadComponent
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