Struct EventLoop

Source
pub struct EventLoop<H: Handler + Clone + 'static> { /* private fields */ }
Expand description

Workers manager.

Implementations§

Source§

impl<H: Handler + Clone + 'static> EventLoop<H>

Source

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

Source

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

Adds a queue to process its jobs.

Source

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

Removes a queue from job processing.

Source

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

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

Source

pub fn jobcount_current_node(&self) -> usize

Number of jobs produced by the current server.

Source

pub fn current_node_id(&self) -> String

Identifier of the current server.

Source

pub fn do_cycle(&mut self)

Connects to the server doing most jobs.

Source

pub fn run(&mut self, cycle: usize)

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

Source

pub fn run_times(&mut self, times: usize)

Runs until times jobs are received.

Source

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

Runs times jobs and changes server every cycle.

Source

pub fn stop(self)

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

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.