Struct disqrust::EventLoop [] [src]

pub struct EventLoop<H: Handler + Clone + 'static> {
    // some fields omitted
}

Workers manager.

Methods

impl<H: Handler + Clone + 'static> EventLoop<H>
[src]

fn new(disque: Disque, numworkers: usize, handler: H) -> Self

fn watch_queue(&mut self, queue_name: Vec<u8>)

Adds a queue to process its jobs.

fn unwatch_queue(&mut self, queue_name: &Vec<u8>)

Removes a queue from job processing.

fn choose_favorite_node(&self) -> (Vec<u8>, usize)

Connects to the server that is issuing most of the jobs.

fn jobcount_current_node(&self) -> usize

Number of jobs produced by the current server.

fn current_node_id(&self) -> String

Identifier of the current server.

fn do_cycle(&mut self)

Connects to the server doing most jobs.

fn run(&mut self, cycle: usize)

Runs for ever. Every cycle jobs reevaluates which server to use.

fn run_times(&mut self, times: usize)

Runs until times jobs are received.

fn run_times_cycle(&mut self, times: usize, cycle: usize)

Runs times jobs and changes server every cycle.

fn stop(self)

Sends a kill signal to all workers and waits for them to finish their current job.