Trait batch_system::PollHandler[][src]

pub trait PollHandler<N, C> {
    fn begin(&mut self, batch_size: usize);
fn handle_control(&mut self, control: &mut C) -> Option<usize>;
fn handle_normal(&mut self, normal: &mut N) -> Option<usize>;
fn end(&mut self, batch: &mut [Box<N>]); fn pause(&mut self) { ... }
fn get_priority(&self) -> Priority { ... } }

A handler that poll all FSM in ready.

A General process works like following:

loop {
    begin
    if control is ready:
        handle_control
    foreach ready normal:
        handle_normal
    end
}

Note that, every poll thread has its own handler, which doesn’t have to be Sync.

Required methods

fn begin(&mut self, batch_size: usize)[src]

This function is called at the very beginning of every round.

fn handle_control(&mut self, control: &mut C) -> Option<usize>[src]

This function is called when handling readiness for control FSM.

If returned value is Some, then it represents a length of channel. This function will only be called for the same fsm after channel’s lengh is larger than the value. If it returns None, then this function will still be called for the same FSM in the next loop unless the FSM is stopped.

fn handle_normal(&mut self, normal: &mut N) -> Option<usize>[src]

This function is called when handling readiness for normal FSM.

The returned value is handled in the same way as handle_control.

fn end(&mut self, batch: &mut [Box<N>])[src]

This function is called at the end of every round.

Loading content...

Provided methods

fn pause(&mut self)[src]

This function is called when batch system is going to sleep.

fn get_priority(&self) -> Priority[src]

This function returns the priority of this handler.

Loading content...

Implementors

Loading content...