pub struct TranscodeJob {
pub id: String,
pub config: TranscodeJobConfig,
pub status: TranscodeStatus,
pub retry_count: u32,
pub created_at: SystemTime,
pub started_at: Option<SystemTime>,
pub completed_at: Option<SystemTime>,
pub error: Option<String>,
pub output: Option<TranscodeOutput>,
pub progress: f64,
}Expand description
A transcode job with state tracking.
Fields§
§id: StringUnique job ID.
config: TranscodeJobConfigJob configuration.
status: TranscodeStatusCurrent status.
retry_count: u32Number of retry attempts made.
created_at: SystemTimeTime when the job was created.
started_at: Option<SystemTime>Time when the job started.
completed_at: Option<SystemTime>Time when the job completed or failed.
error: Option<String>Error message if the job failed.
output: Option<TranscodeOutput>Output if the job completed successfully.
progress: f64Progress percentage (0-100).
Implementations§
Source§impl TranscodeJob
impl TranscodeJob
Sourcepub fn new(config: TranscodeJobConfig) -> Self
pub fn new(config: TranscodeJobConfig) -> Self
Creates a new transcode job.
Sourcepub fn complete(&mut self, output: TranscodeOutput)
pub fn complete(&mut self, output: TranscodeOutput)
Marks the job as completed with output.
Sourcepub fn fail(&mut self, error: impl Into<String>)
pub fn fail(&mut self, error: impl Into<String>)
Marks the job as failed with an error message.
Sourcepub fn update_progress(&mut self, progress: f64)
pub fn update_progress(&mut self, progress: f64)
Updates the job progress.
Sourcepub fn increment_retry(&mut self)
pub fn increment_retry(&mut self)
Increments the retry count.
Sourcepub fn elapsed_time(&self) -> Option<Duration>
pub fn elapsed_time(&self) -> Option<Duration>
Gets the elapsed time since the job started.
Sourcepub fn total_time(&self) -> Option<Duration>
pub fn total_time(&self) -> Option<Duration>
Gets the total time from creation to completion.
Sourcepub fn is_timed_out(&self) -> bool
pub fn is_timed_out(&self) -> bool
Checks if the job has timed out.
Sourcepub fn status_string(&self) -> String
pub fn status_string(&self) -> String
Gets a human-readable status description.
Trait Implementations§
Source§impl Clone for TranscodeJob
impl Clone for TranscodeJob
Source§fn clone(&self) -> TranscodeJob
fn clone(&self) -> TranscodeJob
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TranscodeJob
impl RefUnwindSafe for TranscodeJob
impl Send for TranscodeJob
impl Sync for TranscodeJob
impl Unpin for TranscodeJob
impl UnsafeUnpin for TranscodeJob
impl UnwindSafe for TranscodeJob
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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