pub struct RuntimeOwner { /* private fields */ }Expand description
Owns one Tokio runtime and its root service context.
Dropping this value without an explicit shutdown starts Tokio background shutdown and logs any still-tracked work.
Implementations§
Source§impl RuntimeOwner
impl RuntimeOwner
Sourcepub fn plan(
config: RuntimeConfig,
) -> Result<RuntimeOwnerPlan, RuntimeContractViolation>
pub fn plan( config: RuntimeConfig, ) -> Result<RuntimeOwnerPlan, RuntimeContractViolation>
Validates runtime configuration before runtime construction.
§Errors
Returns a deterministic contract violation without discovering system resources or starting a Tokio runtime.
Sourcepub fn new() -> RuntimeResult<Self>
pub fn new() -> RuntimeResult<Self>
Builds an owner from the internally validated default profile.
§Errors
Returns an operational error when process-memory discovery or runtime
construction fails. Use Self::plan when the caller supplies any
runtime configuration or memory-limit value.
Sourcepub fn root_context(&self) -> &RootServiceContext
pub fn root_context(&self) -> &RootServiceContext
Returns the root context used to derive owned component scopes.
Sourcepub fn config(&self) -> &RuntimeConfig
pub fn config(&self) -> &RuntimeConfig
Returns the validated runtime configuration.
Sourcepub fn resources(&self) -> &RuntimeResources
pub fn resources(&self) -> &RuntimeResources
Returns the process-wide resource capabilities.
Sourcepub fn block_on<F>(&self, future: F) -> F::Outputwhere
F: Future,
pub fn block_on<F>(&self, future: F) -> F::Outputwhere
F: Future,
Blocks the current thread until future completes.
A future above the runtime’s inline boundary is polled from the heap, so a process entrypoint does not need to box its root future.
Sourcepub async fn shutdown_tasks(&self) -> ShutdownReport
pub async fn shutdown_tasks(&self) -> ShutdownReport
Cancels and awaits tracked tasks until the configured deadline.
Sourcepub fn shutdown_runtime_blocking(self) -> RuntimeResult<ShutdownReport>
pub fn shutdown_runtime_blocking(self) -> RuntimeResult<ShutdownReport>
Blocks while shutting down tracked work and the Tokio runtime.
§Errors
Returns an error when invoked from inside a Tokio runtime.
Sourcepub fn shutdown_background(self) -> ShutdownReport
pub fn shutdown_background(self) -> ShutdownReport
Cancels tracked work and asks Tokio to finish runtime shutdown in the background.
The returned report captures only the immediate task-group shutdown state; background Tokio work is not awaited by this method.
Sourcepub fn shutdown_runtime_blocking_with_timeout(
self,
timeout: Duration,
) -> RuntimeResult<ShutdownReport>
pub fn shutdown_runtime_blocking_with_timeout( self, timeout: Duration, ) -> RuntimeResult<ShutdownReport>
Blocks while shutting down tracked work within timeout.
§Errors
Returns an error when invoked from inside a Tokio runtime.
Sourcepub fn shutdown_runtime_blocking_until(
self,
deadline: ShutdownDeadline,
) -> RuntimeResult<ShutdownReport>
pub fn shutdown_runtime_blocking_until( self, deadline: ShutdownDeadline, ) -> RuntimeResult<ShutdownReport>
Shuts down tracked work and the Tokio runtime using an existing absolute deadline.
This is the process-entrypoint boundary for a deadline already frozen by
crate::ServiceLifecycle. It never grants a new timeout to the runtime layer.
§Errors
Returns an unsupported-operation runtime failure when called from an asynchronous Tokio context.
Source§impl RuntimeOwner
impl RuntimeOwner
Sourcepub async fn shutdown_tasks_until(
&self,
deadline: ShutdownDeadline,
) -> ShutdownReport
pub async fn shutdown_tasks_until( &self, deadline: ShutdownDeadline, ) -> ShutdownReport
Cancels and joins all owned tasks using an existing absolute deadline.
This keeps nested lifecycle owners on the caller’s single shutdown budget without consuming or destroying the owned Tokio runtime.