Skip to main content

Jobs

Struct Jobs 

Source
pub struct Jobs { /* private fields */ }
Expand description

The jobs, folded from the journal.

Implementations§

Source§

impl Jobs

Source

pub fn new() -> Self

Source

pub fn with_tombstones(self, count: usize, secs: f64) -> Self

Remembers at most count forgotten jobs, each for secs seconds, to drop their late events (0 turns it off).

Source

pub fn advance(&mut self, now: f64)

Moves the model’s clock on to now (it never goes back): when a job forgotten from now on is forgotten. Folding an event does it.

Source

pub fn forgotten(&self, id: &str) -> bool

Whether id was forgotten lately: its events are dropped until a job.started starts it again.

Source

pub fn with_log_lines(self, lines: usize) -> Self

Keeps lines lines of each job’s log.

Source

pub fn with_history(self, jobs: usize) -> Self

Keeps jobs finished top-level jobs.

Source

pub fn apply(&mut self, e: &Incoming<'_>, now: f64) -> bool

Folds an event at time now; whether it changed a job.

Source

pub fn request(&mut self, id: &str, request: Request)

Notes a request made before its command’s event comes back (a view greys its button at once).

Source

pub fn refine(&mut self, id: &str, fraction: Option<f64>, now: f64)

Overrides a job’s estimate (0 to 1), or gives it back to the model (None); its ancestors follow.

Source

pub fn own_fraction(&self, id: &str) -> Option<f64>

The model’s own estimate of a job, before any refinement and without the last one kept: what the jobs.estimate step starts from.

Source

pub fn left_by(&self, owners: &[&str], commands: &[&str]) -> Left

The jobs going on that a disconnected plugin left (ADR 0028), by what becomes of them. owners are the names it goes by (its plugin id, its owner id), commands the commands that went with it. A job naming it (owner, or command) that is cancellable is to be cancelled by the host; one that is not, and one naming no owner that it published itself (its events’ source), is to be marked orphaned. A child job follows its parent: it is not listed.

Source

pub fn orphaned_by(&self, plugin: &str) -> Vec<String>

The jobs marked orphaned by plugin, in id order: those its return takes back (job.adopted).

Source

pub fn adopt(&mut self, plugin: &str) -> Vec<String>

Takes the orphaned mark off the jobs a plugin left: it is back. Returns the jobs it took it off; the same as folding the job.adopted event naming them.

Source

pub fn dismiss(&mut self, id: &str) -> bool

Forgets a job and its ended descendants (a dismissed error, a cleared history entry); an active job is kept, unless it is orphaned (nothing may ever end it). A descendant still going on (and not orphaned) is not forgotten with it: it becomes a top-level job, with its own children, and ends on its own. Each job forgotten leaves a tombstone: its late events are dropped.

Source

pub fn clear_finished(&mut self)

Forgets every finished top-level job.

Source

pub fn get(&self, id: &str) -> Option<&Job>

Source

pub fn log(&self, id: &str) -> Vec<&str>

The lines of a job’s log still kept, oldest first.

Source

pub fn log_from(&self, id: &str, from: u64) -> Vec<&str>

The lines of a job’s log from line from on (numbered from 0 since the job first started), as far as they are still kept: what a console that showed from lines writes next.

Source

pub fn all(&self) -> Vec<&Job>

Every job, in the order they first started.

Source

pub fn roots(&self) -> Vec<&Job>

Top-level jobs (no parent, or a parent not known), in order.

Source

pub fn children(&self, id: &str) -> Vec<&Job>

A job’s children, in order.

Source

pub fn active(&self) -> Vec<&Job>

The jobs going on, in order.

Source

pub fn idle(&self) -> bool

Whether no job that something still owns goes on (what an agent waits for). An orphaned job (Job::orphaned: its plugin is disconnected) may never end and nobody is there to end it, so it is not waited on: Jobs::orphans says it apart.

Source

pub fn orphans(&self) -> Vec<&Job>

The orphaned jobs still going on, in order: left by their disconnected plugin, not counted by Jobs::idle.

Source

pub fn is_empty(&self) -> bool

Source

pub fn summary(&self) -> Summary

All jobs at a glance (the status bar’s).

Source

pub fn take_changed(&mut self) -> BTreeSet<String>

The jobs changed since the last call (by id), for views that coalesce.

Source

pub fn describe(&self, now: f64) -> Json

What the jobs debug collector shows.

Trait Implementations§

Source§

impl Clone for Jobs

Source§

fn clone(&self) -> Jobs

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Jobs

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Jobs

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Jobs

§

impl RefUnwindSafe for Jobs

§

impl Send for Jobs

§

impl Sync for Jobs

§

impl Unpin for Jobs

§

impl UnsafeUnpin for Jobs

§

impl UnwindSafe for Jobs

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.