Skip to main content

RuntimeContext

Struct RuntimeContext 

Source
pub struct RuntimeContext { /* private fields */ }

Implementations§

Source§

impl RuntimeContext

Source

pub fn handle(&self) -> &Handle

Source

pub fn blocking(&self) -> &BlockingExecutor

Source

pub fn resources(&self) -> &Arc<ResourceLedger>

Aggregate process accountant shared by every VM and trusted subsystem.

Source

pub fn tasks(&self) -> &TaskSupervisor

Source

pub fn metrics(&self) -> &RuntimeMetrics

Source

pub fn max_active_vm_executors(&self) -> usize

Source

pub fn vm_executor_teardown_timeout(&self) -> Duration

Source

pub fn blocking_job_timeout(&self) -> Duration

Source

pub fn fairness(&self) -> &FairWorkBroker

Source

pub fn allocate_vm_generation(&self) -> Result<u64, RuntimeBuildError>

Allocate an identity in the same process-wide namespace as the shared fairness broker. Every sidecar facade using this runtime must draw from this counter; per-facade counters can collide after an earlier VM retires.

Source

pub fn vm_generation(&self) -> Option<u64>

VM generation bound to this admission scope, when this is a VM-scoped context. Fairness keys use this generation rather than a capability’s per-registry generation, which restarts for every VM.

Source

pub fn terminal_failure(&self) -> Option<TaskTerminalReport>

First failed or panicked task in this process/VM admission scope. This is a durable lifecycle latch, not a drainable telemetry queue.

Source

pub fn close_admission(&self)

Permanently close task and blocking-job admission for this context scope and every clone of it. Existing admitted work retains ownership until its normal terminal path releases accounting.

Source

pub fn admission_is_open(&self) -> bool

Source

pub async fn admission_closed(&self)

Resolve when this admission scope begins teardown.

The notification is armed before checking the atomic flag so a close between observation and await cannot be lost. Each VM-scoped context owns a distinct signal; closing one VM never cancels process or sibling VM work.

Source

pub fn scoped(&self, resources: Arc<ResourceLedger>) -> Self

Create a VM-scoped admission view without creating another runtime, scheduler, queue, or worker.

Source

pub fn scoped_for_vm( &self, resources: Arc<ResourceLedger>, generation: u64, ) -> Self

Source

pub fn spawn<F>( &self, class: TaskClass, future: F, ) -> Result<JoinHandle<F::Output>, TaskSpawnError>
where F: Future + Send + 'static, F::Output: Send + 'static,

Source

pub fn spawn_result<F, T, E>( &self, class: TaskClass, future: F, ) -> Result<JoinHandle<Result<T, E>>, TaskSpawnError>
where F: Future<Output = Result<T, E>> + Send + 'static, T: Send + 'static, E: Send + 'static,

Source

pub fn spawn_owned<F, H>( &self, class: TaskClass, owner: TaskOwner, on_terminal: H, future: F, ) -> Result<JoinHandle<F::Output>, TaskSpawnError>
where F: Future + Send + 'static, F::Output: Send + 'static, H: Fn(&TaskTerminalReport) + Send + Sync + 'static,

Spawn work with an explicit lifecycle owner. The terminal hook runs for every exit reason after task accounting is reconciled and outside the supervisor lock, so it can fail/close the owner without lock inversion.

Source

pub fn spawn_owned_result<F, T, E, H>( &self, class: TaskClass, owner: TaskOwner, on_terminal: H, future: F, ) -> Result<JoinHandle<Result<T, E>>, TaskSpawnError>
where F: Future<Output = Result<T, E>> + Send + 'static, T: Send + 'static, E: Send + 'static, H: Fn(&TaskTerminalReport) + Send + Sync + 'static,

Trait Implementations§

Source§

impl Clone for RuntimeContext

Source§

fn clone(&self) -> RuntimeContext

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RuntimeContext

Source§

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

Formats the value using the given formatter. Read more

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.