pub struct WorkerPool { /* private fields */ }Expand description
Worker pool manager.
Implementations§
Source§impl WorkerPool
impl WorkerPool
Sourcepub fn new(config: WorkerPoolConfig) -> Self
pub fn new(config: WorkerPoolConfig) -> Self
Create a new worker pool.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create with default configuration.
Sourcepub fn register_worker(&self, worker: Worker) -> Result<WorkerId>
pub fn register_worker(&self, worker: Worker) -> Result<WorkerId>
Register a new worker.
Sourcepub fn unregister_worker(&self, worker_id: WorkerId) -> Result<()>
pub fn unregister_worker(&self, worker_id: WorkerId) -> Result<()>
Unregister a worker.
Sourcepub fn get_worker(&self, worker_id: WorkerId) -> Result<Arc<RwLock<Worker>>>
pub fn get_worker(&self, worker_id: WorkerId) -> Result<Arc<RwLock<Worker>>>
Get a worker by ID.
Sourcepub fn get_workers_by_status(
&self,
status: WorkerStatus,
) -> Vec<Arc<RwLock<Worker>>>
pub fn get_workers_by_status( &self, status: WorkerStatus, ) -> Vec<Arc<RwLock<Worker>>>
Get workers by status.
Sourcepub fn update_worker_usage(
&self,
worker_id: WorkerId,
usage: WorkerUsage,
) -> Result<()>
pub fn update_worker_usage( &self, worker_id: WorkerId, usage: WorkerUsage, ) -> Result<()>
Update worker resource usage.
Sourcepub fn check_worker_health(&self, worker_id: WorkerId) -> Result<bool>
pub fn check_worker_health(&self, worker_id: WorkerId) -> Result<bool>
Check worker health.
Sourcepub fn check_all_workers(&self) -> Result<Vec<WorkerId>>
pub fn check_all_workers(&self) -> Result<Vec<WorkerId>>
Run health checks on all workers.
Sourcepub fn select_worker(
&self,
requirements: &ResourceRequirements,
strategy: SelectionStrategy,
) -> Result<WorkerId>
pub fn select_worker( &self, requirements: &ResourceRequirements, strategy: SelectionStrategy, ) -> Result<WorkerId>
Select a worker for task execution.
Sourcepub fn get_worker_metrics(&self, worker_id: WorkerId) -> Result<WorkerMetrics>
pub fn get_worker_metrics(&self, worker_id: WorkerId) -> Result<WorkerMetrics>
Get worker metrics.
Sourcepub fn get_statistics(&self) -> WorkerPoolStatistics
pub fn get_statistics(&self) -> WorkerPoolStatistics
Get pool statistics.
Sourcepub fn drain_worker(&self, worker_id: WorkerId) -> Result<()>
pub fn drain_worker(&self, worker_id: WorkerId) -> Result<()>
Drain a worker (no new tasks).
Sourcepub fn resume_worker(&self, worker_id: WorkerId) -> Result<()>
pub fn resume_worker(&self, worker_id: WorkerId) -> Result<()>
Resume a drained worker.
Sourcepub fn get_worker_count(&self) -> usize
pub fn get_worker_count(&self) -> usize
Get the current number of workers in the pool.
Trait Implementations§
Source§impl Clone for WorkerPool
impl Clone for WorkerPool
Source§fn clone(&self) -> WorkerPool
fn clone(&self) -> WorkerPool
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for WorkerPool
impl !RefUnwindSafe for WorkerPool
impl Send for WorkerPool
impl Sync for WorkerPool
impl Unpin for WorkerPool
impl UnsafeUnpin for WorkerPool
impl !UnwindSafe for WorkerPool
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