pub struct WorkerManager { /* private fields */ }Expand description
Manages background workers for the Learning layer.
Workers are registered with configs and can be dispatched individually or all at once. The manager tracks running state and results.
Implementations§
Source§impl WorkerManager
impl WorkerManager
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create a worker manager with all 12 default workers registered.
Sourcepub fn register(&self, worker_type: WorkerType, config: WorkerConfig)
pub fn register(&self, worker_type: WorkerType, config: WorkerConfig)
Register a worker with its configuration.
Replaces any existing config for the same worker type.
Sourcepub fn register_implementation(
&self,
worker_type: WorkerType,
implementation: Box<dyn Worker>,
)
pub fn register_implementation( &self, worker_type: WorkerType, implementation: Box<dyn Worker>, )
Register a concrete implementation for a worker type.
The implementation’s execute() method will be called when the
worker is dispatched. If no implementation is registered for a
worker type, dispatching that worker will return an error.
Sourcepub fn has_implementation(&self, worker_type: WorkerType) -> bool
pub fn has_implementation(&self, worker_type: WorkerType) -> bool
Check if a worker has a registered implementation.
Sourcepub fn unregister_implementation(&self, worker_type: WorkerType) -> bool
pub fn unregister_implementation(&self, worker_type: WorkerType) -> bool
Unregister a worker implementation.
Sourcepub fn unregister(&self, worker_type: WorkerType) -> bool
pub fn unregister(&self, worker_type: WorkerType) -> bool
Unregister a worker.
Sourcepub fn is_registered(&self, worker_type: WorkerType) -> bool
pub fn is_registered(&self, worker_type: WorkerType) -> bool
Check if a worker is registered.
Sourcepub fn dispatch(&self, worker_type: WorkerType) -> Result<WorkerResult, String>
pub fn dispatch(&self, worker_type: WorkerType) -> Result<WorkerResult, String>
Dispatch a single worker for execution.
Returns the result of the worker’s execution. If the worker is already running, returns an error. If the worker is not registered or disabled, returns an error.
Sourcepub fn dispatch_all(&self) -> Vec<WorkerResult>
pub fn dispatch_all(&self) -> Vec<WorkerResult>
Dispatch all enabled workers.
Returns results for each dispatched worker.
Sourcepub fn status(&self) -> WorkerManagerStatus
pub fn status(&self) -> WorkerManagerStatus
Get the current status of the worker manager.
Sourcepub fn enable(&self, worker_type: WorkerType) -> bool
pub fn enable(&self, worker_type: WorkerType) -> bool
Enable a worker.
Sourcepub fn disable(&self, worker_type: WorkerType) -> bool
pub fn disable(&self, worker_type: WorkerType) -> bool
Disable a worker.