pub struct RuntimeTaskContext { /* private fields */ }Implementations§
Source§impl RuntimeTaskContext
impl RuntimeTaskContext
pub fn new( cancellation: RuntimeCancellationToken, deadline: Option<Instant>, ) -> Self
pub fn without_deadline(cancellation: RuntimeCancellationToken) -> Self
pub fn with_timeout(timeout: Duration) -> Self
pub fn cancellation(&self) -> &RuntimeCancellationToken
pub fn child(&self) -> Self
Sourcepub fn constrained_by(&self, request: &Self) -> Result<Self>
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.
Sourcepub fn with_admitted_parallelism(
self,
admitted_parallelism: NonZeroUsize,
) -> Self
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.
pub fn admitted_parallelism(&self) -> NonZeroUsize
Sourcepub fn with_executor_thread_limit(self, limit: NonZeroUsize) -> Self
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.
pub fn executor_thread_limit(&self) -> Option<NonZeroUsize>
Sourcepub fn with_memory_reservation(
self,
reservation: RuntimeMemoryReservation,
) -> Self
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.
pub fn memory_reservation(&self) -> Option<RuntimeMemoryReservation>
Sourcepub fn has_resource_controllers(&self) -> bool
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.
Sourcepub fn with_memory_controller(
self,
controller: Arc<dyn RuntimeMemoryController>,
) -> Self
pub fn with_memory_controller( self, controller: Arc<dyn RuntimeMemoryController>, ) -> Self
Binds actual allocation ownership to an already admitted task.
Sourcepub fn reserve_working_memory(
&self,
bytes: u64,
) -> Result<Option<Box<dyn RuntimeMemoryPermit>>, RuntimeMemoryError>
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.
Sourcepub fn with_io_wave_controller(
self,
controller: Arc<dyn RuntimeIoWaveController>,
) -> Self
pub fn with_io_wave_controller( self, controller: Arc<dyn RuntimeIoWaveController>, ) -> Self
Binds the controller owned by a successful runtime admission.
Sourcepub fn acquire_io_wave(
&self,
slots: NonZeroUsize,
) -> Result<Option<Box<dyn RuntimeIoWavePermit>>, RuntimeIoWaveError>
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.
Sourcepub fn try_acquire_io_wave(
&self,
slots: NonZeroUsize,
) -> Result<RuntimeIoWaveTryAcquire, RuntimeIoWaveError>
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.
Sourcepub fn with_work_limit(self, limit: usize) -> Self
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.
pub fn has_work_limit(&self) -> bool
pub fn work_units(&self) -> usize
Sourcepub fn check_work_limit(&self) -> Result<()>
pub fn check_work_limit(&self) -> Result<()>
Preserve a typed refusal across adapters whose error transport is text.
Sourcepub fn charge_work(&self, units: usize) -> Result<()>
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.