pub struct Backlog { /* private fields */ }Expand description
The table itself. Cloning gives another handle onto the same table,
which is how the assembly point can stop what a tool started without
either of them knowing about the other. A clone carries scratch
too, so it keeps naming that backlog’s directories.
Implementations§
Source§impl Backlog
impl Backlog
pub fn new() -> Backlog
Sourcepub fn with_window(window: PollBudget) -> Backlog
pub fn with_window(window: PollBudget) -> Backlog
A table whose callers block for this window before a command is handed to the background.
Sourcepub fn with_sink(self, sink: Sink) -> Backlog
pub fn with_sink(self, sink: Sink) -> Backlog
The same table, handing what a command writes to sink while
the command is still inside its window (crates/runtime/spec/Backlog.lean §8-28-3).
Sourcepub fn run(
&self,
owner: RunId,
scope: &Address,
what: String,
command: Command,
) -> Result<Started, AxError>
pub fn run( &self, owner: RunId, scope: &Address, what: String, command: Command, ) -> Result<Started, AxError>
Starts a command, waits out the short window, and hands back either its result or a handle onto it.
The command’s program, arguments, working directory and
environment are the caller’s; this module owns only where the
output goes and how the waiting is done. A command that outlives
its window is owed to owner and to no other run.
§Errors
E_TOOL_UNAVAILABLE when the program cannot be started, and
E_STORAGE_FATAL when the place its output goes cannot be
written.
Sourcepub fn enrol_run(
&self,
scope: &Address,
what: String,
) -> Result<BacklogId, AxError>
pub fn enrol_run( &self, scope: &Address, what: String, ) -> Result<BacklogId, AxError>
Enters a run a resident handed down, so a halt on its scope can
reach it. The assembly layer calls this before the drive and
Backlog::leave after it.
§Errors
E_STORAGE_FATAL when the table cannot be reached.
Sourcepub fn stopping(&self, id: BacklogId) -> Result<bool, AxError>
pub fn stopping(&self, id: BacklogId) -> Result<bool, AxError>
Whether a halt has reached this member. A run asks at each safe
point and answers true with Interrupt::Cancel; a member that
has already left the table is not stopping, it is gone.
§Errors
E_STORAGE_FATAL when the table cannot be reached.
Sourcepub fn leave(&self, id: BacklogId) -> Result<(), AxError>
pub fn leave(&self, id: BacklogId) -> Result<(), AxError>
Takes a run member out once it has frozen. A run that stayed
would be reported standing after its own run_frozen line.
§Errors
E_STORAGE_FATAL when the table cannot be reached.
Sourcepub fn halt(&self, scope: Option<&Address>) -> Result<usize, AxError>
pub fn halt(&self, scope: Option<&Address>) -> Result<usize, AxError>
Stops every member inside a scope, or every member in the city when no scope is named. Returns how many were reached.
A member is stopped where it stands, and the run that started it comes back to its next boundary rather than staying inside a system call. A run member is marked rather than killed: it comes back to its own next safe point and cancels there.
§Errors
E_STORAGE_FATAL when the table cannot be reached, which means
a thread died holding it.
Sourcepub fn harvest(&self, owner: RunId) -> Result<Vec<Finished>, AxError>
pub fn harvest(&self, owner: RunId) -> Result<Vec<Finished>, AxError>
Takes every background member of owner that has stopped, in
table order, and lets go of every stopped member whose run has
ended.
A member is reported once and then forgotten: this is what a caller appends to the tail of its next tool result, and a result delivered twice would read as the command having run twice. A member another run started is never reported here, because that tail goes into this run’s model and onto its lines of the ledger.
§Errors
E_STORAGE_FATAL when the table cannot be reached.
Sourcepub fn release(&self, owner: RunId) -> usize
pub fn release(&self, owner: RunId) -> usize
Terminates every background command owner started, marks each
as owed to nobody, and returns how many there were. The run has
ended, so no later tool result of its own can carry them; the
next harvest by any run lets their process handles and files go
without reading their output to anyone.
Infallible by construction: lowering a claim and killing a
process hold on any state of the table, so a table a dead thread
left locked is still reached, while every other call keeps
answering E_STORAGE_FATAL. The caller is a drop, which has
nobody to hand a failure to.