pub struct ExecutionContext { /* private fields */ }Expand description
Shared controls passed through every stage of an out-of-core operation.
Implementations§
Source§impl ExecutionContext
impl ExecutionContext
Sourcepub fn builder() -> ExecutionContextBuilder
pub fn builder() -> ExecutionContextBuilder
Starts a declarative context builder with bounded defaults.
Sourcepub fn with_cancellation(&self, cancellation: CancellationToken) -> Self
pub fn with_cancellation(&self, cancellation: CancellationToken) -> Self
Shares resource accounts and the executor while assigning task-local cancellation. Cancelling this task does not cancel independent tasks using the same budgets.
Sourcepub const fn image_search_limit(&self) -> usize
pub const fn image_search_limit(&self) -> usize
The most candidate symmetry images a crystal search may examine.
A crystal environment is found by trying every symmetry operation and lattice translation that could bring a copy within reach, so the work grows with the unit’s extent as well as its atom count. Exceeding the limit is an error, never a silent truncation; raise it deliberately after reviewing the cost.
Sourcepub fn memory_budget(&self) -> MemoryBudget
pub fn memory_budget(&self) -> MemoryBudget
Returns this context’s execution-memory ceiling.
Sourcepub const fn worker_budget(&self) -> usize
pub const fn worker_budget(&self) -> usize
Maximum native tasks one operation may submit to the shared pool.
Sourcepub const fn cancellation(&self) -> &CancellationToken
pub const fn cancellation(&self) -> &CancellationToken
Returns the shared cooperative cancellation token.
Sourcepub const fn scratch_policy(&self) -> ScratchPolicy
pub const fn scratch_policy(&self) -> ScratchPolicy
Returns the reusable scratch policy.
Sourcepub const fn temp_storage_policy(&self) -> &TempStoragePolicy
pub const fn temp_storage_policy(&self) -> &TempStoragePolicy
Returns the temporary-storage policy.
Sourcepub fn create_spill_file(&self, key: &str) -> Result<SpillFile, SpillError>
pub fn create_spill_file(&self, key: &str) -> Result<SpillFile, SpillError>
Creates one bounded, execution-owned spill file.
The key becomes the deterministic file name below the configured root. A file with the same key is never overwritten.
§Errors
Returns SpillError::Disabled when spill is not configured, or a
storage error when the key, disk budget, or destination is invalid.
Sourcepub fn spill_bytes(&self) -> u64
pub fn spill_bytes(&self) -> u64
Returns temporary bytes currently retained by this execution graph.
Sourcepub fn total_spilled_bytes(&self) -> u64
pub fn total_spilled_bytes(&self) -> u64
Total physical bytes written to execution-owned spill files.
Sourcepub fn reserved_bytes(&self) -> usize
pub fn reserved_bytes(&self) -> usize
Bytes currently retained by execution-owned allocations.
Sourcepub fn peak_reserved_bytes(&self) -> usize
pub fn peak_reserved_bytes(&self) -> usize
Highest number of execution-owned bytes retained concurrently.
Sourcepub fn live_batches(&self) -> usize
pub fn live_batches(&self) -> usize
Batch leases that are currently alive.
Sourcepub fn peak_live_batches(&self) -> usize
pub fn peak_live_batches(&self) -> usize
Highest number of batch leases alive concurrently.
Sourcepub fn available_bytes(&self) -> usize
pub fn available_bytes(&self) -> usize
Bytes not yet reserved: the budget minus everything currently charged.
Tiled algorithms read this to shrink their block size to fit before they would otherwise refuse.
Sourcepub fn try_reserve(
&self,
bytes: usize,
) -> Result<MemoryReservation, MemoryBudgetError>
pub fn try_reserve( &self, bytes: usize, ) -> Result<MemoryReservation, MemoryBudgetError>
Charges retained bytes against this context until the result is dropped.
§Errors
Returns MemoryBudgetError::Exhausted when the requested bytes do not
fit alongside current reservations.
Source§impl ExecutionContext
impl ExecutionContext
Sourcepub fn temporary_workspace(
&self,
maximum_bytes: u64,
) -> Result<TemporaryWorkspace, SpillError>
pub fn temporary_workspace( &self, maximum_bytes: u64, ) -> Result<TemporaryWorkspace, SpillError>
Reserves temporary bytes before creating one private native-tool directory. Concurrent tools and spill files share this context’s disk ceiling.
§Errors
Returns disabled storage, exhausted reservation or filesystem errors.
Sourcepub fn temporary_workspace_with_file_limit(
&self,
maximum_bytes: u64,
maximum_files: usize,
) -> Result<TemporaryWorkspace, SpillError>
pub fn temporary_workspace_with_file_limit( &self, maximum_bytes: u64, maximum_files: usize, ) -> Result<TemporaryWorkspace, SpillError>
Reserves a private directory with an explicit regular-file count ceiling.
§Errors
Refuses zero file capacity, disabled storage or an exhausted disk budget.
Trait Implementations§
Source§impl Clone for ExecutionContext
impl Clone for ExecutionContext
Source§impl Debug for ExecutionContext
impl Debug for ExecutionContext
Auto Trait Implementations§
impl !RefUnwindSafe for ExecutionContext
impl !UnwindSafe for ExecutionContext
impl Freeze for ExecutionContext
impl Send for ExecutionContext
impl Sync for ExecutionContext
impl Unpin for ExecutionContext
impl UnsafeUnpin for ExecutionContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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