pub struct TranscodeWatcher { /* private fields */ }Expand description
Directory-based transcode watcher.
Call TranscodeWatcher::scan to detect new files, and
TranscodeWatcher::drain_pending to obtain TranscodeConfig values
ready for submission to the job queue.
Implementations§
Source§impl TranscodeWatcher
impl TranscodeWatcher
Sourcepub fn new(config: WatchConfig) -> Self
pub fn new(config: WatchConfig) -> Self
Creates a new watcher from config.
Sourcepub fn config(&self) -> &WatchConfig
pub fn config(&self) -> &WatchConfig
Returns the watcher configuration.
Sourcepub fn poll_interval(&self) -> Duration
pub fn poll_interval(&self) -> Duration
Returns the poll interval as a Duration.
Sourcepub fn scan(&mut self) -> Result<usize>
pub fn scan(&mut self) -> Result<usize>
Scans the watch directory for new eligible files.
Returns the number of new files enqueued.
§Errors
Returns an error if the directory cannot be read.
Sourcepub fn pending(&self) -> Vec<&WatchEntry>
pub fn pending(&self) -> Vec<&WatchEntry>
Returns all pending entries (without removing them from the queue).
Sourcepub fn drain_pending(&mut self) -> Vec<(WatchEntry, TranscodeConfig)>
pub fn drain_pending(&mut self) -> Vec<(WatchEntry, TranscodeConfig)>
Drains all pending entries into a Vec<TranscodeConfig> for submission
to the job queue, marking each entry as Processing.
Sourcepub fn mark_done(&mut self, source: &Path) -> Result<()>
pub fn mark_done(&mut self, source: &Path) -> Result<()>
Marks a watch entry as successfully processed and applies the configured post-process action (move / delete / leave).
§Errors
Returns an error if the file move or delete operation fails.
Sourcepub fn mark_failed(&mut self, source: &Path, reason: &str) -> Result<()>
pub fn mark_failed(&mut self, source: &Path, reason: &str) -> Result<()>
Marks a watch entry as failed and applies the configured on-failure action.
§Errors
Returns an error if the file operation fails.
Sourcepub fn status_counts(&self) -> WatchStatusCounts
pub fn status_counts(&self) -> WatchStatusCounts
Returns the number of entries in each status category.
Auto Trait Implementations§
impl Freeze for TranscodeWatcher
impl RefUnwindSafe for TranscodeWatcher
impl Send for TranscodeWatcher
impl Sync for TranscodeWatcher
impl Unpin for TranscodeWatcher
impl UnsafeUnpin for TranscodeWatcher
impl UnwindSafe for TranscodeWatcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more