pub struct DMSCResourceScheduler { /* private fields */ }Expand description
Resource scheduling algorithm using performance history and policies
This scheduler uses device performance history, current load, and custom policies to intelligently allocate resources to the most suitable devices.
Implementations§
Source§impl DMSCResourceScheduler
impl DMSCResourceScheduler
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new resource scheduler with default settings.
This method initializes the scheduler with empty performance history, device loads, and scheduling policies.
§Returns
A new DMSCResourceScheduler instance with default settings.
Sourcepub fn schedule_resource(
&mut self,
request: &ResourceRequest,
available_devices: &[DMSCDevice],
) -> Option<String>
pub fn schedule_resource( &mut self, request: &ResourceRequest, available_devices: &[DMSCDevice], ) -> Option<String>
Schedule a resource request to the most suitable device based on capabilities, load, and policies.
This method evaluates available devices against the resource request requirements, calculates a score for each suitable device, and returns the ID of the best device.
§Parameters
request: Resource request with requirements and priorityavailable_devices: List of available devices to consider for scheduling
§Returns
The ID of the most suitable device for the request, or None if no suitable device is found.
Sourcepub fn record_performance(
&mut self,
device_id: &str,
latency_ms: f64,
throughput: f64,
error_rate: f64,
utilization: f64,
)
pub fn record_performance( &mut self, device_id: &str, latency_ms: f64, throughput: f64, error_rate: f64, utilization: f64, )
Record device performance after task completion.
This method records performance metrics for a device, including latency, throughput, error rate, and utilization. These records are used for future scheduling decisions.
§Parameters
device_id: ID of the device whose performance is being recordedlatency_ms: Latency in millisecondsthroughput: Throughput in operations per seconderror_rate: Error rate as a fraction (0.0 to 1.0)utilization: Resource utilization as a fraction (0.0 to 1.0)
Sourcepub fn update_device_load(&mut self, device_id: &str, load: f64)
pub fn update_device_load(&mut self, device_id: &str, load: f64)
Update the current load of a device.
This method updates the load of a device, clamping the value between 0.0 and 1.0. The load is used in scheduling decisions to avoid overloading devices.
§Parameters
device_id: ID of the device whose load is being updatedload: New load value (0.0 to 1.0)
Sourcepub fn add_policy(&mut self, policy: SchedulingPolicy)
pub fn add_policy(&mut self, policy: SchedulingPolicy)
Add a scheduling policy to the scheduler.
This method adds a scheduling policy to the scheduler and sorts the policies by priority (highest first) to ensure they are evaluated in the correct order.
§Parameters
policy: Scheduling policy to add
Trait Implementations§
Source§impl Clone for DMSCResourceScheduler
impl Clone for DMSCResourceScheduler
Source§fn clone(&self) -> DMSCResourceScheduler
fn clone(&self) -> DMSCResourceScheduler
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DMSCResourceScheduler
impl Debug for DMSCResourceScheduler
Auto Trait Implementations§
impl Freeze for DMSCResourceScheduler
impl RefUnwindSafe for DMSCResourceScheduler
impl Send for DMSCResourceScheduler
impl Sync for DMSCResourceScheduler
impl Unpin for DMSCResourceScheduler
impl UnwindSafe for DMSCResourceScheduler
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request