pub struct Jobs { /* private fields */ }Expand description
The jobs, folded from the journal.
Implementations§
Source§impl Jobs
impl Jobs
pub fn new() -> Self
Sourcepub fn with_tombstones(self, count: usize, secs: f64) -> Self
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).
Sourcepub fn advance(&mut self, now: f64)
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.
Sourcepub fn forgotten(&self, id: &str) -> bool
pub fn forgotten(&self, id: &str) -> bool
Whether id was forgotten lately: its events are dropped until a
job.started starts it again.
Sourcepub fn with_log_lines(self, lines: usize) -> Self
pub fn with_log_lines(self, lines: usize) -> Self
Keeps lines lines of each job’s log.
Sourcepub fn with_history(self, jobs: usize) -> Self
pub fn with_history(self, jobs: usize) -> Self
Keeps jobs finished top-level jobs.
Sourcepub fn apply(&mut self, e: &Incoming<'_>, now: f64) -> bool
pub fn apply(&mut self, e: &Incoming<'_>, now: f64) -> bool
Folds an event at time now; whether it changed a job.
Sourcepub fn request(&mut self, id: &str, request: Request)
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).
Sourcepub fn refine(&mut self, id: &str, fraction: Option<f64>, now: f64)
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.
Sourcepub fn own_fraction(&self, id: &str) -> Option<f64>
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.
Sourcepub fn left_by(&self, owners: &[&str], commands: &[&str]) -> Left
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.
Sourcepub fn orphaned_by(&self, plugin: &str) -> Vec<String>
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).
Sourcepub fn adopt(&mut self, plugin: &str) -> Vec<String>
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.
Sourcepub fn dismiss(&mut self, id: &str) -> bool
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.
Sourcepub fn clear_finished(&mut self)
pub fn clear_finished(&mut self)
Forgets every finished top-level job.
pub fn get(&self, id: &str) -> Option<&Job>
Sourcepub fn log_from(&self, id: &str, from: u64) -> Vec<&str>
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.
Sourcepub fn idle(&self) -> bool
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.
Sourcepub fn orphans(&self) -> Vec<&Job>
pub fn orphans(&self) -> Vec<&Job>
The orphaned jobs still going on, in order: left by their
disconnected plugin, not counted by Jobs::idle.
pub fn is_empty(&self) -> bool
Sourcepub fn take_changed(&mut self) -> BTreeSet<String>
pub fn take_changed(&mut self) -> BTreeSet<String>
The jobs changed since the last call (by id), for views that coalesce.