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: DerivativeStorageModeImplementations§
Source§impl ResourcePolicy
impl ResourcePolicy
Sourcepub fn default_library() -> Self
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).
Sourcepub fn for_observed_memory(availability: &MemoryAvailability) -> Self
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.
Sourcepub fn analytic_operator_required() -> Self
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).
Sourcepub fn for_problem(hints: ProblemHints) -> Self
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.
Sourcepub fn permissive_small_data() -> Self
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.
pub const fn material_policy(&self) -> MaterializationPolicy
Trait Implementations§
Source§impl Clone for ResourcePolicy
impl Clone for ResourcePolicy
Source§fn clone(&self) -> ResourcePolicy
fn clone(&self) -> ResourcePolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ResourcePolicy
impl RefUnwindSafe for ResourcePolicy
impl Send for ResourcePolicy
impl Sync for ResourcePolicy
impl Unpin for ResourcePolicy
impl UnsafeUnpin for ResourcePolicy
impl UnwindSafe for ResourcePolicy
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