[][src]Struct json_job_dispatch::Director

pub struct Director<'a> { /* fields omitted */ }

Dispatch jobs to registered handlers.

Jobs are sorted into accept, reject, and fail directories based on whether they were accepted by the relevant handler. Once handled, a .stamp file containing the timestamp of when the job was completed is created beside the final location. In addition, rejected and failed jobs have a .reason file describing what happened.

Methods

impl<'a> Director<'a>[src]

pub fn new(root: &Path) -> Result<Self, DirectorError>[src]

Creates a new Director.

The accept and reject directories are created as children of the given directory.

pub fn add_handler<K>(
    &mut self,
    kind: K,
    handler: &'a dyn Handler
) -> Result<(), DirectorError> where
    K: Into<String>, 
[src]

Add a handler for jobs labeled as kind.

pub fn run_one<P>(&self, path: P) -> RunResult where
    P: AsRef<Path>, 
[src]

Handle a single file.

Returns true if the loop should terminate.

pub fn run<I, P>(&self, paths: I) -> RunResult where
    I: IntoIterator<Item = P>,
    P: AsRef<Path>, 
[src]

Handle a batch of files at once.

Returns true if the loop should terminate.

pub fn watch_directory(&self, path: &Path) -> Result<RunResult, DirectorError>[src]

Watch a directory for new job files and act upon them.

Upon startup, this searches the directory for existing files. These files are processed in lexigraphic order.

Trait Implementations

impl<'a> Debug for Director<'a>[src]

Auto Trait Implementations

impl<'a> !Send for Director<'a>

impl<'a> !Sync for Director<'a>

impl<'a> Unpin for Director<'a>

impl<'a> !UnwindSafe for Director<'a>

impl<'a> !RefUnwindSafe for Director<'a>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,