pub struct PreemptionController { /* private fields */ }Expand description
Controller for managing transfer preemption
Tracks active transfers and coordinates preemption decisions to ensure high-priority data can preempt lower priorities.
Implementations§
Source§impl PreemptionController
impl PreemptionController
Sourcepub fn new() -> PreemptionController
pub fn new() -> PreemptionController
Create a new preemption controller
Sourcepub async fn register_transfer(
&self,
class: QoSClass,
bytes_total: usize,
can_pause: bool,
) -> Uuid
pub async fn register_transfer( &self, class: QoSClass, bytes_total: usize, can_pause: bool, ) -> Uuid
Register a new active transfer
Returns the transfer ID for tracking.
Sourcepub async fn unregister_transfer(&self, id: Uuid)
pub async fn unregister_transfer(&self, id: Uuid)
Unregister a completed or cancelled transfer
Sourcepub async fn get_transfer(&self, id: Uuid) -> Option<Arc<ActiveTransfer>>
pub async fn get_transfer(&self, id: Uuid) -> Option<Arc<ActiveTransfer>>
Get a transfer by ID
Sourcepub async fn should_preempt(&self, incoming_class: QoSClass) -> bool
pub async fn should_preempt(&self, incoming_class: QoSClass) -> bool
Check if preemption is needed for incoming data of given class
Returns true if there are lower-priority transfers that can be preempted.
Sourcepub async fn pause_transfers_below(&self, class: QoSClass) -> Vec<Uuid>
pub async fn pause_transfers_below(&self, class: QoSClass) -> Vec<Uuid>
Pause all transfers below a given priority
Returns the IDs of paused transfers for later resumption.
Sourcepub async fn resume_transfers(&self, transfers_to_resume: Vec<Uuid>)
pub async fn resume_transfers(&self, transfers_to_resume: Vec<Uuid>)
Resume previously paused transfers
Sourcepub async fn resume_all(&self)
pub async fn resume_all(&self)
Resume all paused transfers
Sourcepub async fn active_count(&self) -> usize
pub async fn active_count(&self) -> usize
Get number of active transfers
Sourcepub fn paused_count(&self) -> usize
pub fn paused_count(&self) -> usize
Get number of paused transfers
Sourcepub fn preemption_count(&self) -> usize
pub fn preemption_count(&self) -> usize
Get total preemption events
Sourcepub async fn transfers_by_class(
&self,
class: QoSClass,
) -> Vec<Arc<ActiveTransfer>>
pub async fn transfers_by_class( &self, class: QoSClass, ) -> Vec<Arc<ActiveTransfer>>
Get transfers by class
Sourcepub async fn preemptable_transfers(
&self,
by_class: QoSClass,
) -> Vec<Arc<ActiveTransfer>>
pub async fn preemptable_transfers( &self, by_class: QoSClass, ) -> Vec<Arc<ActiveTransfer>>
Get all preemptable transfers for a given class
Sourcepub async fn bandwidth_used_below(&self, class: QoSClass) -> usize
pub async fn bandwidth_used_below(&self, class: QoSClass) -> usize
Calculate bandwidth currently used by transfers below a priority
Sourcepub async fn cleanup_completed(&self) -> usize
pub async fn cleanup_completed(&self) -> usize
Clean up completed transfers
Sourcepub async fn stats(&self) -> PreemptionStats
pub async fn stats(&self) -> PreemptionStats
Get controller statistics
Trait Implementations§
Source§impl Debug for PreemptionController
impl Debug for PreemptionController
Source§impl Default for PreemptionController
impl Default for PreemptionController
Source§fn default() -> PreemptionController
fn default() -> PreemptionController
Auto Trait Implementations§
impl !Freeze for PreemptionController
impl !RefUnwindSafe for PreemptionController
impl Send for PreemptionController
impl Sync for PreemptionController
impl Unpin for PreemptionController
impl UnsafeUnpin for PreemptionController
impl !UnwindSafe for PreemptionController
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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