Skip to main content

RuntimeTaskContext

Struct RuntimeTaskContext 

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

Implementations§

Source§

impl RuntimeTaskContext

Source

pub fn new( cancellation: RuntimeCancellationToken, deadline: Option<Instant>, ) -> Self

Source

pub fn without_deadline(cancellation: RuntimeCancellationToken) -> Self

Source

pub fn with_timeout(timeout: Duration) -> Self

Source

pub fn cancellation(&self) -> &RuntimeCancellationToken

Source

pub fn child(&self) -> Self

Source

pub fn constrained_by(&self, request: &Self) -> Result<Self>

Applies statement constraints without replacing an enclosing admission. Cancellation from either scope stops the statement; cancelling the combined scope does not cancel its parents. Budgets remain shared and can only tighten. Independent controllers cannot represent one admission and are rejected.

Source

pub fn with_admitted_parallelism( self, admitted_parallelism: NonZeroUsize, ) -> Self

Carries the CPU parallelism already reserved by the runtime governor.

This is an execution ceiling, not a request to create worker threads. Executors must still apply their operator memory and input-size limits.

Source

pub fn admitted_parallelism(&self) -> NonZeroUsize

Source

pub fn with_executor_thread_limit(self, limit: NonZeroUsize) -> Self

Carries the physical executor-thread ceiling derived by the runtime governor.

This is distinct from Self::admitted_parallelism, which is the CPU reservation for one task. An absent limit denotes an ungoverned library call.

Source

pub fn executor_thread_limit(&self) -> Option<NonZeroUsize>

Source

pub fn with_memory_reservation( self, reservation: RuntimeMemoryReservation, ) -> Self

Carries the memory already reserved by the runtime governor.

Governed executors must use this reservation instead of a static per-query configuration limit. An absent reservation denotes an ungoverned library call and preserves the configured fallback.

Source

pub fn memory_reservation(&self) -> Option<RuntimeMemoryReservation>

Source

pub fn has_resource_controllers(&self) -> bool

Whether execution carries dynamic resource controllers rather than only a static ceiling. Synchronous adapters must preserve these controllers and must not replace an originating governor admission with a local cap.

Source

pub fn with_memory_controller( self, controller: Arc<dyn RuntimeMemoryController>, ) -> Self

Binds actual allocation ownership to an already admitted task.

Source

pub fn reserve_working_memory( &self, bytes: u64, ) -> Result<Option<Box<dyn RuntimeMemoryPermit>>, RuntimeMemoryError>

Reserve before allocating and retain the returned lease until destruction. Clones and children share their controller. Ungoverned contexts return None; a supplied static ceiling still limits an individual allocation.

Source

pub fn with_io_wave_controller( self, controller: Arc<dyn RuntimeIoWaveController>, ) -> Self

Binds the controller owned by a successful runtime admission.

Source

pub fn acquire_io_wave( &self, slots: NonZeroUsize, ) -> Result<Option<Box<dyn RuntimeIoWavePermit>>, RuntimeIoWaveError>

Acquires capacity for one storage I/O wave when this is an admitted context.

Raw contexts have no controller and return Ok(None). The returned permit must remain live only while physical reads are in flight.

Source

pub fn try_acquire_io_wave( &self, slots: NonZeroUsize, ) -> Result<RuntimeIoWaveTryAcquire, RuntimeIoWaveError>

Attempts to acquire capacity for one storage I/O wave without blocking.

Raw, ungoverned contexts return Acquired(None). Governed contexts return Pending while another wave owns the requested capacity.

Source

pub fn with_work_limit(self, limit: usize) -> Self

Starts a bounded execution scope while retaining every parent limit and the original cancellation, memory and I/O admission. Clones share usage.

Source

pub fn has_work_limit(&self) -> bool

Source

pub fn work_units(&self) -> usize

Source

pub fn check_work_limit(&self) -> Result<()>

Preserve a typed refusal across adapters whose error transport is text.

Source

pub fn charge_work(&self, units: usize) -> Result<()>

Charge explicit candidate work before examining it, including rejected candidates. Checkpoints and allocation byte counts are not work units.

Source

pub fn deadline(&self) -> Option<Instant>

Source

pub fn remaining(&self) -> Option<Duration>

Source

pub fn checkpoint(&self) -> Result<(), RuntimeCancellationReason>

Trait Implementations§

Source§

impl Clone for RuntimeTaskContext

Source§

fn clone(&self) -> Self

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 RuntimeTaskContext

Source§

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

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

impl Default for RuntimeTaskContext

Source§

fn default() -> Self

Returns the “default value” for a type. 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> RuntimeIoWavePermit for T
where T: Debug + Send,

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 = !

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.