pub struct EventLoop<H: Handler + Clone + 'static> { /* private fields */ }
Expand description
Workers manager.
Implementations§
Source§impl<H: Handler + Clone + 'static> EventLoop<H>
impl<H: Handler + Clone + 'static> EventLoop<H>
pub fn new(disque: Disque, numworkers: usize, handler: H) -> Self
Sourcepub fn watch_queue(&mut self, queue_name: Vec<u8>)
pub fn watch_queue(&mut self, queue_name: Vec<u8>)
Adds a queue to process its jobs.
Sourcepub fn unwatch_queue(&mut self, queue_name: &Vec<u8>)
pub fn unwatch_queue(&mut self, queue_name: &Vec<u8>)
Removes a queue from job processing.
Sourcepub fn choose_favorite_node(&self) -> (Vec<u8>, usize)
pub fn choose_favorite_node(&self) -> (Vec<u8>, usize)
Connects to the server that is issuing most of the jobs.
Sourcepub fn jobcount_current_node(&self) -> usize
pub fn jobcount_current_node(&self) -> usize
Number of jobs produced by the current server.
Sourcepub fn current_node_id(&self) -> String
pub fn current_node_id(&self) -> String
Identifier of the current server.
Sourcepub fn run(&mut self, cycle: usize)
pub fn run(&mut self, cycle: usize)
Runs for ever. Every cycle
jobs reevaluates which server to use.
Sourcepub fn run_times_cycle(&mut self, times: usize, cycle: usize)
pub fn run_times_cycle(&mut self, times: usize, cycle: usize)
Runs times
jobs and changes server every cycle
.
Auto Trait Implementations§
impl<H> !Freeze for EventLoop<H>
impl<H> !RefUnwindSafe for EventLoop<H>
impl<H> Send for EventLoop<H>
impl<H> !Sync for EventLoop<H>
impl<H> Unpin for EventLoop<H>
impl<H> !UnwindSafe for EventLoop<H>
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