pub struct DistributedJob {
pub id: u64,
pub name: String,
pub state: JobState,
pub created_at: u64,
pub updated_at: u64,
pub priority: i32,
/* private fields */
}Expand description
A single distributed encoding job with progress and ETA tracking.
Fields§
§id: u64§name: String§state: JobState§created_at: u64§updated_at: u64§priority: i32Implementations§
Source§impl DistributedJob
impl DistributedJob
Sourcepub fn new(id: u64, name: &str, priority: i32, now: u64) -> Self
pub fn new(id: u64, name: &str, priority: i32, now: u64) -> Self
Create a new job in the Queued state.
Sourcepub fn update_progress(&mut self, pct: f32, now: u64)
pub fn update_progress(&mut self, pct: f32, now: u64)
Transition to Running with the given progress percentage.
Stores a progress sample for ETA computation and sets started_at_ms
on the first call.
Sourcepub fn progress_pct(&self) -> f32
pub fn progress_pct(&self) -> f32
Current progress as a percentage (0.0–100.0).
Returns 0.0 for jobs not yet in the Running state.
Sourcepub fn eta_ms(&self) -> Option<u64>
pub fn eta_ms(&self) -> Option<u64>
Estimated time to completion in milliseconds.
Uses the most recent two progress samples to compute the current
encoding rate, then extrapolates to 100 %. Returns None when
there are fewer than two samples, the progress is already at 100 %,
or the elapsed time is zero.
Trait Implementations§
Source§impl Clone for DistributedJob
impl Clone for DistributedJob
Source§fn clone(&self) -> DistributedJob
fn clone(&self) -> DistributedJob
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 DistributedJob
impl RefUnwindSafe for DistributedJob
impl Send for DistributedJob
impl Sync for DistributedJob
impl Unpin for DistributedJob
impl UnsafeUnpin for DistributedJob
impl UnwindSafe for DistributedJob
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> 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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request