pub struct RunningWorkload {
pub kind: String,
pub slot: String,
pub dev_url: Option<String>,
pub public_url: Option<String>,
pub console_url: Option<String>,
pub log_buffer: Option<LogBuffer>,
pub notes: Vec<String>,
pub build_log_end: Option<usize>,
/* private fields */
}Expand description
Handle to a workload that’s been brought up. Owns the lifecycle: drop
or call RunningWorkload::shutdown to take it back down.
Fields§
§kind: StringWorkload kind that was reconciled (e.g. "mesofact-static").
slot: StringSlot role this workload occupies on the mirror (e.g. "static").
dev_url: Option<String>Local URL the workload exposes, when applicable. None for
workloads that publish to a non-local artifact store (e.g. R2).
public_url: Option<String>Notional URL of the deployed artifact in the production case
(e.g. https://yah.dev). None until Cloudflare/R2 wiring lands.
console_url: Option<String>Secondary local UI console, if the workload exposes one (e.g. MinIO
console on a pond tier). Surfaced as a separate chip in the Services
matrix next to dev_url.
log_buffer: Option<LogBuffer>Ring buffer for stdout/stderr from the workload’s child process.
None for workloads that don’t capture stdio (e.g. container-backed).
notes: Vec<String>R546-B12: human-readable lines the reconciler wants the operator to see
on THIS run — what it actually did, not what is configured. A clean
static-asset reconcile used to print nothing at all, so a successful
publish and a successful no-op were indistinguishable at the apply
surface, and the one view that would have disambiguated them (yah cloud status) was itself blind.
Deliberately NOT on RunningWorkloadSummary: that type is serialized
across the process boundary to the desktop UI, and this is per-run
console output, not state the UI should cache.
build_log_end: Option<usize>LogBuffer cursor marking the end of the build phase, for a
component that was compiled before being spawned (local-process
with cargo_package set). Lines before this index in log_buffer are
cargo build output; lines at or after are the spawned process’s own
stdout/stderr. None when nothing was built (no cargo_package, or a
reconciler that predates this field).
Implementations§
Source§impl RunningWorkload
impl RunningWorkload
Sourcepub fn adopted(
kind: impl Into<String>,
slot: impl Into<String>,
dev_url: Option<String>,
) -> Self
pub fn adopted( kind: impl Into<String>, slot: impl Into<String>, dev_url: Option<String>, ) -> Self
Create a handle for a workload that’s already running externally
(e.g. embedded in yah-camp). No subprocess is owned; shutdown is a
no-op so the caller can call shutdown() uniformly.
Sourcepub fn with_teardown<F, Fut>(self, teardown: F) -> Self
pub fn with_teardown<F, Fut>(self, teardown: F) -> Self
Attach an explicit teardown to a handle for an externally-running workload (R714-B1).
adopted() alone gives a handle whose shutdown() is a documented
no-op. That is right for workloads another process owns and will keep
re-asserting (pond containers under camp’s yubaba), and wrong for ones
this process started and nobody else will ever stop — for those the ■
button reported success while the container kept running.
teardown runs on shutdown() and NOT on Drop; see Self::teardown.
Sourcepub fn with_notes(self, notes: Vec<String>) -> Self
pub fn with_notes(self, notes: Vec<String>) -> Self
Attach per-run operator-facing lines (R546-B12). See Self::notes.
Sourcepub fn with_control(self, control: Option<ControlEndpoint>) -> Self
pub fn with_control(self, control: Option<ControlEndpoint>) -> Self
Record where to poll this workload’s process-control channel, when it
declared one (R715-F4). A no-op (leaves control: None) when the
argument is None — callers can pass the reconciler’s resolved
endpoint straight through without an if let.
Sourcepub async fn poll_control(&self) -> Option<ProcStatus>
pub async fn poll_control(&self) -> Option<ProcStatus>
Ask this workload’s process-control channel for a live status
document (R715-F4). None when no channel was declared, or when the
endpoint didn’t answer — both are “nothing new to show”, not errors;
see crate::proc_control::fetch_status for why a poll failure isn’t
itself meaningful.
Sourcepub fn is_alive(&self) -> bool
pub fn is_alive(&self) -> bool
Whether the supervisor task that owns this workload’s child process is
still running. spawn_native_log_supervisor (native_support.rs) exits
as soon as NativeRuntime::get_workload reports a terminal state —
which itself comes from a real child.wait() in kamaji’s native
backend, so this catches a crash (segfault, panic, SIGKILL) the same
way it catches a clean exit, not just an unresponsive process.
A workload with no supervisor (RunningWorkload::adopted — runs
outside this process, e.g. a pond container camp re-asserts) has
nothing to check here and reports alive unconditionally; its liveness
is whatever tracks it, not this handle.
Sourcepub fn with_build_log_end(self, cursor: Option<usize>) -> Self
pub fn with_build_log_end(self, cursor: Option<usize>) -> Self
Record where the build phase ends in log_buffer, for a component
that was compiled before being spawned. See Self::build_log_end.
Sourcepub fn with_public_url(self, url: impl Into<String>) -> Self
pub fn with_public_url(self, url: impl Into<String>) -> Self
Set the public URL for a published workload (e.g. "https://yah.dev").
Sourcepub fn with_console_url(self, url: impl Into<String>) -> Self
pub fn with_console_url(self, url: impl Into<String>) -> Self
Set the console URL for a workload that exposes a secondary local UI (e.g. MinIO console on a pond tier).
Sourcepub async fn shutdown(self) -> Result<()>
pub async fn shutdown(self) -> Result<()>
Gracefully tear down: signal the supervisor, await its exit, then run any explicit teardown hook.
The hook runs LAST and its error propagates. A stop that could not tear the workload down must surface as an error, never as a silent success — that silence is the whole of R714-B1.
Trait Implementations§
Source§impl Debug for RunningWorkload
impl Debug for RunningWorkload
Source§impl Drop for RunningWorkload
impl Drop for RunningWorkload
Source§impl From<&RunningWorkload> for RunningWorkloadSummary
impl From<&RunningWorkload> for RunningWorkloadSummary
Source§fn from(r: &RunningWorkload) -> Self
fn from(r: &RunningWorkload) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for RunningWorkload
impl !UnwindSafe for RunningWorkload
impl Freeze for RunningWorkload
impl Send for RunningWorkload
impl Sync for RunningWorkload
impl Unpin for RunningWorkload
impl UnsafeUnpin for RunningWorkload
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> Fruit for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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