Skip to main content

RunningWorkload

Struct RunningWorkload 

Source
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: String

Workload kind that was reconciled (e.g. "mesofact-static").

§slot: String

Slot 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

Source

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.

Source

pub fn with_teardown<F, Fut>(self, teardown: F) -> Self
where F: FnOnce() -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

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.

Source

pub fn owns_teardown(&self) -> bool

Whether this handle carries a real teardown — i.e. whether a failed Self::shutdown means the workload is still running.

The stop path needs this to decide between an operator-facing error and a log line, and R875-B1 is why it is a property of the handle rather than a list of kinds at the call site. That list started as kind == "container" when R714-B1 gave containers a teardown, and was silently wrong the moment a second kind grew one: an adopted mesofact-dev whose teardown failed reported a successful stop with the server still serving. A handle knows whether it owns the workload; a string comparison at the call site only knows what it was last taught.

Source

pub fn with_notes(self, notes: Vec<String>) -> Self

Attach per-run operator-facing lines (R546-B12). See Self::notes.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn with_public_url(self, url: impl Into<String>) -> Self

Set the public URL for a published workload (e.g. "https://yah.dev").

Source

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).

Source

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for RunningWorkload

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl From<&RunningWorkload> for RunningWorkloadSummary

Source§

fn from(r: &RunningWorkload) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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 T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

Converts 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)

Converts &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)

Converts &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
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Sync + Send>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Fruit for T
where T: Send + Downcast,

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more