pub struct Record {Show 13 fields
pub id: String,
pub plan: Option<String>,
pub wish: String,
pub asked: String,
pub started: Timestamp,
pub ended: Timestamp,
pub outcome: Outcome,
pub cost: f64,
pub cost_unmeasured: bool,
pub steps: Vec<StepRecord>,
pub decisions: Vec<Decision>,
pub versions: Vec<Version>,
pub journal: Vec<Entry>,
}Expand description
One run of a plan.
Fields§
§id: StringWhat names the run: when it started and the plan’s name. Its file in .vpf/runs is {id}.json.
plan: Option<String>The plan’s name, when it has one.
wish: StringThe plan’s wish.
asked: StringWhat the run was started with.
started: TimestampWhen it started.
ended: TimestampWhen it ended, or last stopped to wait.
outcome: OutcomeHow it ended, or what it waits for.
cost: f64What the agents said it cost.
cost_unmeasured: boolWhether some agent did not say what it cost.
steps: Vec<StepRecord>Every step of the plan, in the order written.
decisions: Vec<Decision>What the person decided.
versions: Vec<Version>Each version of the plan the run followed, the first first.
journal: Vec<Entry>Everything the run was given from outside it, by agents, commands, people and the clock, so that it can go on from where it stands without asking any of it again.
Implementations§
Source§impl Record
impl Record
Sourcepub fn still_working(&self, folder: &Path) -> Vec<u32>
pub fn still_working(&self, folder: &Path) -> Vec<u32>
The processes that still work for the run, from a runner that stopped while they worked: the agents and commands it kept in the folder that have not ended.
Sourcepub fn stopped_working(&self, folder: &Path) -> Vec<u32>
pub fn stopped_working(&self, folder: &Path) -> Vec<u32>
The processes of agents and commands kept in the folder for the run that stopped without ending, as when the computer went down: going on does that work again, asking first when it cannot be undone.
Sourcepub fn keep(&self, folder: &Path) -> Result<PathBuf>
pub fn keep(&self, folder: &Path) -> Result<PathBuf>
Writes the record in the folder’s .vpf/runs, in place of what it kept of the run before.
§Errors
When the file cannot be written.
Sourcepub fn add_entries(&mut self, entries: impl IntoIterator<Item = Entry>)
pub fn add_entries(&mut self, entries: impl IntoIterator<Item = Entry>)
Adds entries a Keeper was handed to the run’s journal, in order: an entry under a key
the journal holds takes the place of the one there. A run that stopped in the middle is rebuilt this way
from the record it began with, and goes on without asking any of them again.
Sourcepub fn reply(
&mut self,
key: &str,
reply: Reply,
by: Option<&str>,
) -> Result<(), String>
pub fn reply( &mut self, key: &str, reply: Reply, by: Option<&str>, ) -> Result<(), String>
Gives a waiting run the reply to what it waits for under key, from by when they say who they are. The
run goes on with it when it is resumed.
§Errors
When the run does not wait for key, the reply does not fit what is asked, or the question is for named
people and by is not one of them.
Sourcepub fn change(
&mut self,
plan: &Plan,
approved_by: &str,
at: Timestamp,
) -> Result<(), String>
pub fn change( &mut self, plan: &Plan, approved_by: &str, at: Timestamp, ) -> Result<(), String>
Takes a new version of the plan for a waiting run, approved by approved_by: the run goes on with it from
where it stands when it is resumed.
§Errors
When the run does not wait, no one approved, the plan has problems, a step that ended is not in it as it
was, or a step that started is not in it with the same id, by and do.