pub struct Coordinator { /* private fields */ }Expand description
Coordinator for distributed task execution.
Implementations§
Source§impl Coordinator
impl Coordinator
Sourcepub fn new(config: CoordinatorConfig) -> Self
pub fn new(config: CoordinatorConfig) -> Self
Create a new coordinator.
Sourcepub fn add_worker(&self, worker_id: String, address: String) -> Result<()>
pub fn add_worker(&self, worker_id: String, address: String) -> Result<()>
Add a worker to the coordinator.
Sourcepub fn remove_worker(&self, worker_id: &str) -> Result<()>
pub fn remove_worker(&self, worker_id: &str) -> Result<()>
Remove a worker from the coordinator.
Sourcepub fn update_worker_heartbeat(&self, worker_id: &str) -> Result<()>
pub fn update_worker_heartbeat(&self, worker_id: &str) -> Result<()>
Update worker heartbeat.
Sourcepub fn check_worker_timeouts(&self) -> Result<Vec<String>>
pub fn check_worker_timeouts(&self) -> Result<Vec<String>>
Check for timed-out workers and reassign their tasks.
Sourcepub fn submit_task(
&self,
partition_id: PartitionId,
operation: TaskOperation,
) -> Result<TaskId>
pub fn submit_task( &self, partition_id: PartitionId, operation: TaskOperation, ) -> Result<TaskId>
Submit a task for execution.
Sourcepub fn assign_task(&self, task: Task, worker_id: String) -> Result<()>
pub fn assign_task(&self, task: Task, worker_id: String) -> Result<()>
Assign a task to a worker.
Sourcepub fn complete_task(&self, task_id: TaskId, result: TaskResult) -> Result<()>
pub fn complete_task(&self, task_id: TaskId, result: TaskResult) -> Result<()>
Record task completion.
Sourcepub fn get_available_worker(&self) -> Result<Option<String>>
pub fn get_available_worker(&self) -> Result<Option<String>>
Get the best available worker for a task.
Sourcepub fn get_progress(&self) -> Result<CoordinatorProgress>
pub fn get_progress(&self) -> Result<CoordinatorProgress>
Get execution progress.
Sourcepub fn collect_results(&self) -> Result<Vec<TaskResult>>
pub fn collect_results(&self) -> Result<Vec<TaskResult>>
Collect all task results.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Check if all tasks are complete.
Sourcepub fn list_workers(&self) -> Result<Vec<WorkerInfo>>
pub fn list_workers(&self) -> Result<Vec<WorkerInfo>>
Get list of all workers.
Auto Trait Implementations§
impl Freeze for Coordinator
impl RefUnwindSafe for Coordinator
impl Send for Coordinator
impl Sync for Coordinator
impl Unpin for Coordinator
impl UnsafeUnpin for Coordinator
impl UnwindSafe for Coordinator
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request