pub struct FairWorkBroker { /* private fields */ }Expand description
Process-owned async admission facade over the deterministic HDRR state.
There is exactly one broker per crate::SidecarRuntime. A ready handle
first joins the coalesced VM/capability rings, then receives one bounded
turn. At most one grant is outstanding process-wide, which makes completion
and requeueing atomic and prevents independent handle tasks from bypassing
tenant rotation by racing on Tokio workers.
Implementations§
Source§impl FairWorkBroker
impl FairWorkBroker
pub fn new( config: FairnessConfig, metrics: RuntimeMetrics, ) -> Result<Self, FairnessError>
Sourcepub async fn acquire(
&self,
vm_generation: u64,
capability_id: u64,
requested: FairBudget,
) -> Result<FairWorkTurn, FairnessError>
pub async fn acquire( &self, vm_generation: u64, capability_id: u64, requested: FairBudget, ) -> Result<FairWorkTurn, FairnessError>
Wait for this ready capability’s next process-fair turn. requested
carries the VM’s configured per-turn ceilings; the returned allowance
is the lower of those ceilings and the process scheduler’s grant.
Sourcepub fn retire_capability(
&self,
vm_generation: u64,
capability_id: u64,
) -> Result<bool, FairnessError>
pub fn retire_capability( &self, vm_generation: u64, capability_id: u64, ) -> Result<bool, FairnessError>
Permanently retire one monotonic capability identity for this VM generation. Queued or granted work is revoked immediately. If native work already owns the bounded turn, its completion removes membership; later acquire attempts fail instead of recreating stale scheduler state.
pub fn retire_vm(&self, vm_generation: u64) -> Result<bool, FairnessError>
Trait Implementations§
Source§impl Clone for FairWorkBroker
impl Clone for FairWorkBroker
Source§fn clone(&self) -> FairWorkBroker
fn clone(&self) -> FairWorkBroker
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more