pub struct WorkloadRegistry { /* private fields */ }Expand description
Explicit registry of workload backend factories keyed by provider name.
Implementations§
Source§impl WorkloadRegistry
impl WorkloadRegistry
Sourcepub fn register(
&mut self,
name: impl Into<String>,
factory: Arc<dyn ManagerFactory>,
) -> AppResult<()>
pub fn register( &mut self, name: impl Into<String>, factory: Arc<dyn ManagerFactory>, ) -> AppResult<()>
Register a backend factory under name.
§Errors
Returns ErrorCode::InvalidInput for an empty name
and ErrorCode::AlreadyExists when the name is already registered.
Sourcepub async fn build(
&self,
config: &WorkloadConfig,
) -> AppResult<Arc<dyn Manager>>
pub async fn build( &self, config: &WorkloadConfig, ) -> AppResult<Arc<dyn Manager>>
Build the manager selected by WorkloadConfig::provider.
§Errors
Returns ErrorCode::MissingField when the configured provider is empty
and ErrorCode::NotFound when it is not registered;
otherwise the factory’s own error is propagated.
Trait Implementations§
Source§impl Default for WorkloadRegistry
impl Default for WorkloadRegistry
Source§fn default() -> WorkloadRegistry
fn default() -> WorkloadRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for WorkloadRegistry
impl !UnwindSafe for WorkloadRegistry
impl Freeze for WorkloadRegistry
impl Send for WorkloadRegistry
impl Sync for WorkloadRegistry
impl Unpin for WorkloadRegistry
impl UnsafeUnpin for WorkloadRegistry
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