Skip to main content

WorkerRegistry

Trait WorkerRegistry 

Source
pub trait WorkerRegistry:
    Send
    + Sync
    + 'static {
    // Required methods
    fn register(
        &self,
        worker_id: &str,
        labels: &[String],
    ) -> impl Future<Output = Result<(), RegistryError>> + Send;
    fn heartbeat(
        &self,
        worker_id: &str,
    ) -> impl Future<Output = Result<(), RegistryError>> + Send;
    fn deregister(
        &self,
        worker_id: &str,
    ) -> impl Future<Output = Result<(), RegistryError>> + Send;
    fn list_workers(
        &self,
    ) -> impl Future<Output = Result<Vec<WorkerInfo>, RegistryError>> + Send;
    fn mark_busy(
        &self,
        worker_id: &str,
        job_id: &str,
    ) -> impl Future<Output = Result<(), RegistryError>> + Send;
    fn mark_idle(
        &self,
        worker_id: &str,
    ) -> impl Future<Output = Result<(), RegistryError>> + Send;
}
Expand description

Registry of connected workers and their capabilities.

Used for monitoring and matching jobs to capable workers.

Required Methods§

Source

fn register( &self, worker_id: &str, labels: &[String], ) -> impl Future<Output = Result<(), RegistryError>> + Send

Register a worker with its capability labels.

Source

fn heartbeat( &self, worker_id: &str, ) -> impl Future<Output = Result<(), RegistryError>> + Send

Record a heartbeat from a worker.

Source

fn deregister( &self, worker_id: &str, ) -> impl Future<Output = Result<(), RegistryError>> + Send

Remove a worker from the registry.

Source

fn list_workers( &self, ) -> impl Future<Output = Result<Vec<WorkerInfo>, RegistryError>> + Send

List all registered workers.

Source

fn mark_busy( &self, worker_id: &str, job_id: &str, ) -> impl Future<Output = Result<(), RegistryError>> + Send

Mark a worker as busy with a specific job.

Source

fn mark_idle( &self, worker_id: &str, ) -> impl Future<Output = Result<(), RegistryError>> + Send

Mark a worker as idle (finished or released a job).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§