Skip to main content

CapabilityBudget

Struct CapabilityBudget 

Source
pub struct CapabilityBudget {
    pub memory_bytes: Option<u64>,
    pub cpu_units: Option<u64>,
    pub io_bytes: Option<u64>,
    pub cleanup_budget: Option<Budget>,
    pub artifact_bytes: Option<u64>,
}
Expand description

Explicit resource envelope carried by capability contexts and regions.

None means no explicit envelope for that dimension. Admission can still fail closed by requiring dimensions with CapabilityBudgetRequirements. Child envelopes inherit parent limits and can only tighten them.

Fields§

§memory_bytes: Option<u64>

Resident memory envelope in bytes.

§cpu_units: Option<u64>

Abstract CPU unit envelope.

§io_bytes: Option<u64>

I/O byte envelope.

§cleanup_budget: Option<Budget>

Cleanup/drain budget envelope.

§artifact_bytes: Option<u64>

Artifact-emission byte envelope.

Implementations§

Source§

impl CapabilityBudget

Source

pub const UNSPECIFIED: Self

No explicit resource envelopes.

Source

pub const fn new() -> Self

Creates an empty capability budget.

Source

pub const fn with_memory_bytes(self, bytes: u64) -> Self

Sets the memory envelope in bytes.

Source

pub const fn with_cpu_units(self, units: u64) -> Self

Sets the CPU envelope in abstract units.

Source

pub const fn with_io_bytes(self, bytes: u64) -> Self

Sets the I/O envelope in bytes.

Source

pub const fn with_cleanup_budget(self, budget: Budget) -> Self

Sets the cleanup/drain budget envelope.

Source

pub const fn with_artifact_bytes(self, bytes: u64) -> Self

Sets the artifact-emission envelope in bytes.

Source

pub fn meet(self, child: Self) -> Self

Combines parent and child capability budgets, keeping the tightest envelope for each resource dimension.

Source

pub fn plan_child( self, child: Self, requirements: CapabilityBudgetRequirements, ) -> Result<Self, CapabilityBudgetRefusal>

Computes the effective child envelope and rejects if required dimensions are absent or exhausted.

Use this before admitting a region/task group that needs explicit resource envelopes. On success the returned budget is the value to carry forward in the child Cx or region record.

Source

pub fn validate( self, requirements: CapabilityBudgetRequirements, ) -> Result<(), CapabilityBudgetRefusal>

Validates this budget against required resource dimensions.

Trait Implementations§

Source§

impl Clone for CapabilityBudget

Source§

fn clone(&self) -> CapabilityBudget

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 Copy for CapabilityBudget

Source§

impl Debug for CapabilityBudget

Source§

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

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

impl Default for CapabilityBudget

Source§

fn default() -> CapabilityBudget

Returns the “default value” for a type. Read more
Source§

impl Eq for CapabilityBudget

Source§

impl PartialEq for CapabilityBudget

Source§

fn eq(&self, other: &CapabilityBudget) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CapabilityBudget

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, _span: NoopSpan) -> Self

Instruments this future with a span (no-op when disabled).
Source§

fn in_current_span(self) -> Self

Instruments this future with the current span (no-op when disabled).
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V