Skip to main content

ResourcePolicy

Struct ResourcePolicy 

Source
pub struct ResourcePolicy {
    pub max_single_materialization_bytes: usize,
    pub max_operator_cache_bytes: usize,
    pub max_spatial_distance_cache_bytes: usize,
    pub max_owned_data_cache_bytes: usize,
    pub row_chunk_target_bytes: usize,
    pub derivative_storage_mode: DerivativeStorageMode,
}

Fields§

§max_single_materialization_bytes: usize§max_operator_cache_bytes: usize§max_spatial_distance_cache_bytes: usize§max_owned_data_cache_bytes: usize§row_chunk_target_bytes: usize§derivative_storage_mode: DerivativeStorageMode

Implementations§

Source§

impl ResourcePolicy

Source

pub fn default_library() -> Self

Conservative default suitable for general-purpose use.

Uses MaterializeIfSmall: dense materialization is allowed only when the matrix fits under max_single_materialization_bytes. This lets small-data families that lack an implicit operator work out of the box, while problems whose dense footprint does not fit real memory get a typed refusal that forces the analytic-operator path. Set derivative_storage_mode = AnalyticOperatorRequired explicitly to reject all dense fallback.

Scalar caps expose the governor’s stationary capacity ceiling; they are routing thresholds, not independent budgets, and they do not move with load. Actual materializations and caches must reserve their complete live footprint against the shared governor, so any combination of categories is bounded by one ledger — that reservation, not these caps, is what enforces “fits right now” (#2684).

Source

pub fn for_observed_memory(availability: &MemoryAvailability) -> Self

The library-default policy a process would derive from availability.

Self::default_library is exactly this function applied to the process’s own observation, so the routing thresholds a fit sees are a pure function of the observed environment — and, because every scalar below is taken from MemoryAvailability::capacity_bytes rather than MemoryAvailability::available_bytes, a pure function of that environment’s stationary CAPACITY. Two observations of the same box that differ only in how much memory happened to be free at the instant of the probe therefore produce byte-identical policies, and any route selected from one of these caps is reproducible across processes and across load (#2684).

Exposed rather than kept private so a test can hold capacity fixed and vary free memory without racing the real machine; the live path uses the same code, so the property under test is the shipped one.

Source

pub fn analytic_operator_required() -> Self

Strict mode that rejects every dense fallback. Use when you intend to run only on operator-backed bases (large-scale Duchon/TPS, exact GAMLSS marginal slope, CTN, etc.). The byte caps only govern the residual diagnostic surfaces (materialization itself is forbidden by the mode).

Source

pub fn for_problem(hints: ProblemHints) -> Self

Auto-derive the resource policy from the shape of the problem rather than from an explicit CLI flag.

Shape alone never flips a policy mode: doing so merely moves the old row/column cliff to a byte threshold. Every non-structural path starts permissive and makes its strategy decision from the operation’s checked predicted live bytes versus the governor’s current remaining budget.

hints.marginal_slope_large_scale_active forces strict mode regardless of shape: that path is structurally operator-only and any dense fallback would be a bug, not a memory question.

Source

pub fn permissive_small_data() -> Self

Permissive mode for small-data usage and tests. Admission still uses the same process ledger; only the streaming chunk geometry differs.

Source

pub const fn material_policy(&self) -> MaterializationPolicy

Trait Implementations§

Source§

impl Clone for ResourcePolicy

Source§

fn clone(&self) -> ResourcePolicy

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 ResourcePolicy

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.