Skip to main content

ResidencyController

Struct ResidencyController 

Source
pub struct ResidencyController { /* private fields */ }
Expand description

Validated backend-neutral declarations paired with residency control state.

Concrete backends own their native values separately and mirror every publication or eviction through this controller’s ledger. Keeping the declarations here ensures checkpoint shape policy and plan identity are validated before any backend allocation begins.

Implementations§

Source§

impl ResidencyController

Source

pub fn new<C: RecipeCatalog + ?Sized>( catalog: &C, plan: OffloadPlan, units: impl IntoIterator<Item = OffloadUnit>, ) -> Result<Self, ResidencyControllerError>

Validates declarations against checkpoint metadata and an explicit plan.

Source

pub fn unit(&self, id: &OffloadUnitId) -> Option<&OffloadUnit>

Returns the validated declaration for one planned unit.

Source

pub fn units(&self) -> impl ExactSizeIterator<Item = &OffloadUnit>

Returns declarations in stable unit-identifier order.

Source

pub fn binding_owner( &self, unit: &OffloadUnitId, binding: &WeightBinding, ) -> Option<(&OffloadUnitId, &WeightBinding)>

Resolves a logical alias to its canonical owner unit and binding.

Source

pub fn shared_binding_owner( &self, unit: &OffloadUnitId, binding: &WeightBinding, ) -> Option<(&OffloadUnitId, &WeightBinding)>

Returns the canonical owner location when a binding participates in a shared alias family, including the canonical owner itself.

Source

pub const fn ledger(&self) -> &ResidencyLedger

Returns immutable ownership, capacity, and telemetry state.

Source

pub fn ledger_mut(&mut self) -> &mut ResidencyLedger

Returns mutable ownership, capacity, and telemetry state.

Source

pub fn plan_acquisition( &mut self, ids: &[OffloadUnitId], tier: MemoryTier, ) -> Result<ResidencyAcquisition, ResidencyLedgerError>

Validates one batch and snapshots which requested copies need realization.

Source

pub fn plan_initialization_acquisition( &mut self, ids: &[OffloadUnitId], tier: MemoryTier, ) -> Result<ResidencyAcquisition, ResidencyLedgerError>

Validates a batch while the manager is realizing its initial planned tiers.

Source

pub fn reserve_acquisition( &mut self, acquisition: &ResidencyAcquisition, reservations: &[(OffloadUnitId, u64)], tier: MemoryTier, ) -> Result<Vec<EvictedResidencyCopy>, ResidencyLedgerError>

Reserves backend-supplied physical capacities while protecting the complete batch.

Source

pub fn touch_acquisition_hits( &mut self, acquisition: &ResidencyAcquisition, tier: MemoryTier, ) -> Result<(), ResidencyLedgerError>

Updates recency for copies which were hits when the batch began.

Source

pub fn rollback_acquisition( &mut self, acquisition: &ResidencyAcquisition, tier: MemoryTier, ) -> Result<(), ResidencyLedgerError>

Rolls back every missing copy which remains an unpublished reservation.

Source

pub fn publish_acquisition_copy( &mut self, id: &OffloadUnitId, tier: MemoryTier, actual_bytes: u64, transferred_bytes: u64, transfer_generation: Option<u64>, direction: TransferDirection, duration: Duration, ) -> Result<(), ResidencyLedgerError>

Publishes one realized copy and records its backend transfer observation.

Source

pub fn begin_prefetch( &mut self, id: &OffloadUnitId, tier: MemoryTier, ) -> Result<PrefetchOutcome, ResidencyLedgerError>

Records a prefetch hit or miss before backend realization begins.

Source

pub fn resolve_transfer( &mut self, ids: &[OffloadUnitId], tier: MemoryTier, generation: u64, succeeded: bool, ) -> Result<Vec<EvictedResidencyCopy>, ResidencyLedgerError>

Resolves one exact transfer and returns backend copies invalidated by failure.

Source

pub fn commit_group_window( &mut self, group: &str, active: &[OffloadUnitId], upcoming: &[OffloadUnitId], tier: MemoryTier, ) -> Result<Vec<OffloadUnitId>, ResidencyLedgerError>

Replaces one protected window and selects unique bounded lookahead in caller order.

A concrete backend calls this after any in-flight copies touching the requested units have reached a stable state.

Source

pub fn protect_group_window( &mut self, group: &str, active: &[OffloadUnitId], tier: MemoryTier, ) -> Result<(), ResidencyLedgerError>

Replaces one protected window without selecting or materializing lookahead.

Trait Implementations§

Source§

impl Debug for ResidencyController

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<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> 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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.