pub struct CompletionPlan { /* private fields */ }Expand description
A validated run-to-completion call, separable from the start request it was planned for.
Separate so a binding can start the exec under its sandbox lock and drive it after releasing the lock: a callback that reaches back into the sandbox must not find the lock held by the call that is invoking it.
Implementations§
Source§impl CompletionPlan
impl CompletionPlan
Sourcepub fn new(
request: &StartRequest,
options: CompletionOptions,
) -> Result<CompletionPlan, Error>
pub fn new( request: &StartRequest, options: CompletionOptions, ) -> Result<CompletionPlan, Error>
Plans a call for request, refusing a timeout_sec no deadline can be built from
before anything starts.
Sourcepub fn deadline(&self) -> Duration
pub fn deadline(&self) -> Duration
The client deadline, measured from the start of Self::drive.
Sourcepub async fn drive(
&self,
handle: &ExecHandle,
on_output: Option<Box<dyn FnMut(ExecEvent) -> Pin<Box<dyn Future<Output = ControlFlow<()>> + Send>> + Send>>,
) -> Result<ExecResult, Error>
pub async fn drive( &self, handle: &ExecHandle, on_output: Option<Box<dyn FnMut(ExecEvent) -> Pin<Box<dyn Future<Output = ControlFlow<()>> + Send>> + Send>>, ) -> Result<ExecResult, Error>
Drives a started exec to exactly one result.
The steps, each the specified behavior in crates/model/src/run.rs:
- With a callback, stream to it under the client deadline. The terminal
exitevent means the output is final, so one ack returns it (BIND-8). - Without a callback, or when the stream ended without its
exitevent (a cut past its reconnect budget, a fatal stream error, the callback answeringBreak), or when the ack after the exit event failed: wait and ack under what is left of the deadline (BIND-8). Polling is read-only, so this is safe whatever the stream saw. - When the client deadline expires in either step: kill the process group, then wait
and ack within the client grace (BIND-9). The kill is sent whatever its outcome turns
out to be, and a failed kill still gets the ack: the command may have finished by
itself, and its real result beats a synthesized one. The daemon answers the kill
only once the group is gone, SIGKILLing it after its ten-second
kill_graceif it must (measured 2026-09-24, us-east-1), so the kill can take that long before the grace starts. - When that ack fails too: a synthesized result, exit code 124, naming both failures (BIND-10). Nothing else synthesizes.
An error is returned only for a failure that says nothing about a deadline: a fatal
wait (the exec was collected, the token was refused). A retryable poll failure is
retried inside the wait, as ExecHandle::wait always has.
Trait Implementations§
Source§impl Clone for CompletionPlan
impl Clone for CompletionPlan
Source§fn clone(&self) -> CompletionPlan
fn clone(&self) -> CompletionPlan
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CompletionPlan
impl RefUnwindSafe for CompletionPlan
impl Send for CompletionPlan
impl Sync for CompletionPlan
impl Unpin for CompletionPlan
impl UnsafeUnpin for CompletionPlan
impl UnwindSafe for CompletionPlan
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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more