pub struct TaskDistributor {
pub pending_tasks: HashMap<String, MiningTask>,
}Expand description
Distributes mining tasks to available miners (from .AI3).
Fields§
§pending_tasks: HashMap<String, MiningTask>Task id -> task.
Implementations§
Source§impl TaskDistributor
impl TaskDistributor
Sourcepub fn add_task(&mut self, task: MiningTask)
pub fn add_task(&mut self, task: MiningTask)
Adds a task to the pending set.
Sourcepub fn get_pending_tasks(&self) -> Vec<&MiningTask>
pub fn get_pending_tasks(&self) -> Vec<&MiningTask>
Returns all pending tasks.
Sourcepub fn remove_task(&mut self, task_id: &str) -> Option<MiningTask>
pub fn remove_task(&mut self, task_id: &str) -> Option<MiningTask>
Removes and returns a task by id.
Sourcepub fn cleanup_expired_tasks(&mut self)
pub fn cleanup_expired_tasks(&mut self)
Removes expired tasks from the pending set.
Trait Implementations§
Source§impl Debug for TaskDistributor
impl Debug for TaskDistributor
Source§impl Default for TaskDistributor
impl Default for TaskDistributor
Source§fn default() -> TaskDistributor
fn default() -> TaskDistributor
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TaskDistributor
impl RefUnwindSafe for TaskDistributor
impl Send for TaskDistributor
impl Sync for TaskDistributor
impl Unpin for TaskDistributor
impl UnsafeUnpin for TaskDistributor
impl UnwindSafe for TaskDistributor
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