Skip to main content

HierarchicalDeficitRoundRobin

Struct HierarchicalDeficitRoundRobin 

Source
pub struct HierarchicalDeficitRoundRobin<VmId, CapabilityId> { /* private fields */ }
Expand description

Process-level VM rotation containing a second capability rotation per VM.

The scheduler is intentionally serial: callers select one bounded turn, perform no more than its allowance, then report actual use. This makes the selection order reproducible in tests and keeps requeueing atomic.

Implementations§

Source§

impl<VmId, CapabilityId> HierarchicalDeficitRoundRobin<VmId, CapabilityId>
where VmId: Clone + Ord, CapabilityId: Clone + Ord,

Source

pub fn new(config: FairnessConfig) -> Result<Self, FairnessError>

Source

pub fn new_with_metrics( config: FairnessConfig, metrics: RuntimeMetrics, ) -> Result<Self, FairnessError>

Source

pub fn config(&self) -> FairnessConfig

Source

pub fn mark_ready( &mut self, vm_id: VmId, capability_id: CapabilityId, ) -> Result<MembershipUpdate, FairnessError>

Insert one ready membership edge. Repeated marks never add queue entries.

Source

pub fn clear_ready( &mut self, vm_id: &VmId, capability_id: &CapabilityId, ) -> bool

Remove queued readiness without discarding retained, capped deficit.

Source

pub fn select_next( &mut self, ) -> Result<Option<FairSelection<VmId, CapabilityId>>, FairnessError>

Choose the next VM and capability in activation order.

Source

pub fn complete( &mut self, selection: &FairSelection<VmId, CapabilityId>, used: FairBudget, still_ready: bool, ) -> Result<(), FairnessError>

Charge actual work and atomically requeue a source that remains ready.

Source

pub fn remove_capability( &mut self, vm_id: &VmId, capability_id: &CapabilityId, ) -> Result<bool, FairnessError>

Source

pub fn clear_vm_ready(&mut self, vm_id: &VmId) -> bool

Revoke every queued/rearmed turn for a VM without disturbing a turn already issued to native work. VM retirement uses this before attempting removal so no queued capability can run while issued work settles.

Source

pub fn remove_vm(&mut self, vm_id: &VmId) -> Result<bool, FairnessError>

Source

pub fn snapshot( &self, vm_id: &VmId, capability_id: &CapabilityId, ) -> Option<FairnessSnapshot>

Source

pub fn ready_vm_count(&self) -> usize

Source

pub fn ready_capability_count(&self, vm_id: &VmId) -> usize

Trait Implementations§

Source§

impl<VmId: Debug, CapabilityId: Debug> Debug for HierarchicalDeficitRoundRobin<VmId, CapabilityId>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<VmId, CapabilityId> Freeze for HierarchicalDeficitRoundRobin<VmId, CapabilityId>
where VmId: Freeze, CapabilityId: Freeze,

§

impl<VmId, CapabilityId> RefUnwindSafe for HierarchicalDeficitRoundRobin<VmId, CapabilityId>
where VmId: RefUnwindSafe, CapabilityId: RefUnwindSafe,

§

impl<VmId, CapabilityId> Send for HierarchicalDeficitRoundRobin<VmId, CapabilityId>
where VmId: Send, CapabilityId: Send,

§

impl<VmId, CapabilityId> Sync for HierarchicalDeficitRoundRobin<VmId, CapabilityId>
where VmId: Sync, CapabilityId: Sync,

§

impl<VmId, CapabilityId> Unpin for HierarchicalDeficitRoundRobin<VmId, CapabilityId>
where VmId: Unpin, CapabilityId: Unpin,

§

impl<VmId, CapabilityId> UnsafeUnpin for HierarchicalDeficitRoundRobin<VmId, CapabilityId>
where VmId: UnsafeUnpin, CapabilityId: UnsafeUnpin,

§

impl<VmId, CapabilityId> UnwindSafe for HierarchicalDeficitRoundRobin<VmId, CapabilityId>
where VmId: RefUnwindSafe + UnwindSafe, CapabilityId: UnwindSafe + RefUnwindSafe,

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> 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, 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.