[−][src]Struct izta::runner::Runner
Runner
spawns the task executor and allows new tasks to be scheduled.
Methods
impl<F> Runner<F> where
F: Fn(&Task) -> RunTaskResult,
F: Send + 'static + Sync + Clone + Copy,
[src]
F: Fn(&Task) -> RunTaskResult,
F: Send + 'static + Sync + Clone + Copy,
pub fn new(
f: F,
db_url: &str,
table_name: &str,
queues: Vec<String>
) -> Runner<F> where
F: Fn(&Task) -> RunTaskResult,
F: Send + 'static + Sync + Clone + Copy,
[src]
f: F,
db_url: &str,
table_name: &str,
queues: Vec<String>
) -> Runner<F> where
F: Fn(&Task) -> RunTaskResult,
F: Send + 'static + Sync + Clone + Copy,
Returns a new Runner
. Must call start()
to begin executing tasks.
Arguments
f
- Callback generated byprocess_jobs!
. See Examples below.db_url
- Address of Postgres database containing tasks table. Syntax: postgres://username:password@hostname:port/db_nametable_name
- The name of the Postgres table containing tasks.queues
- If empty, process any task. If not empty, only process tasks belonging to specified queues.
Example
// Provided that JobA and JobB are two types implementing the Job trait let runner = Runner::new( process_jobs!(JobA, JobB), "postgres://izta:password@localhost:5432/izta_test", "tasks", vec![], );
pub fn start(&self)
[src]
Begin executing tasks.
pub fn add_task(&self, req: &TaskReq) -> Task
[src]
Creates and schedules a new Task
for execution from a TaskReq
. Returns new task
pub fn finished(&self) -> Vec<Task>
[src]
Return all finished tasks managed by this Runner
pub fn failed(&self) -> Vec<Task>
[src]
Return all failed tasks managed by this Runner
Auto Trait Implementations
impl<F> Send for Runner<F>
impl<F> !Sync for Runner<F>
impl<F> Unpin for Runner<F> where
F: Unpin,
F: Unpin,
impl<F> !UnwindSafe for Runner<F>
impl<F> !RefUnwindSafe for Runner<F>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self