[−][src]Struct json_job_dispatch::Director
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]
&mut self,
kind: K,
handler: &'a dyn Handler
) -> Result<(), DirectorError> where
K: Into<String>,
Add a handler for jobs labeled as kind
.
pub fn run_one<P>(&self, path: P) -> RunResult where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
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]
I: IntoIterator<Item = P>,
P: AsRef<Path>,
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
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]
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 = Infallible
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<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,