pub struct DataLocalityOptimizer { /* private fields */ }Expand description
Data locality optimizer.
Implementations§
Source§impl DataLocalityOptimizer
impl DataLocalityOptimizer
Sourcepub fn new(config: LocalityConfig) -> Self
pub fn new(config: LocalityConfig) -> Self
Create a new data locality optimizer.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create with default configuration.
Sourcepub fn register_data(&self, data_key: String, worker_id: WorkerId) -> Result<()>
pub fn register_data(&self, data_key: String, worker_id: WorkerId) -> Result<()>
Register data location.
Sourcepub fn unregister_data(&self, data_key: &str, worker_id: WorkerId) -> Result<()>
pub fn unregister_data(&self, data_key: &str, worker_id: WorkerId) -> Result<()>
Unregister data location.
Sourcepub fn record_access(&self, data_key: &str, worker_id: WorkerId) -> Result<()>
pub fn record_access(&self, data_key: &str, worker_id: WorkerId) -> Result<()>
Record data access.
Sourcepub fn get_workers_with_data(&self, data_key: &str) -> Vec<WorkerId>
pub fn get_workers_with_data(&self, data_key: &str) -> Vec<WorkerId>
Get workers that have specific data.
Sourcepub fn get_worker_data(&self, worker_id: WorkerId) -> Vec<String>
pub fn get_worker_data(&self, worker_id: WorkerId) -> Vec<String>
Get data available on a worker.
Sourcepub fn get_data_location(&self, data_key: &str) -> Option<DataLocation>
pub fn get_data_location(&self, data_key: &str) -> Option<DataLocation>
Get data location information.
Sourcepub fn recommend_placement(
&self,
required_data: &[String],
candidate_workers: &[WorkerId],
) -> Result<PlacementRecommendation>
pub fn recommend_placement( &self, required_data: &[String], candidate_workers: &[WorkerId], ) -> Result<PlacementRecommendation>
Recommend task placement based on data locality.
Sourcepub fn schedule_prefetch(
&self,
data_key: String,
target_workers: Vec<WorkerId>,
) -> Result<()>
pub fn schedule_prefetch( &self, data_key: String, target_workers: Vec<WorkerId>, ) -> Result<()>
Schedule data prefetch for upcoming tasks.
Sourcepub fn clear_prefetch_schedule(&self)
pub fn clear_prefetch_schedule(&self)
Clear prefetch schedule.
Sourcepub fn record_transfer(
&self,
data_key: &str,
_from_worker: WorkerId,
to_worker: WorkerId,
bytes: u64,
) -> Result<()>
pub fn record_transfer( &self, data_key: &str, _from_worker: WorkerId, to_worker: WorkerId, bytes: u64, ) -> Result<()>
Record data transfer.
Sourcepub fn record_prefetch(&self)
pub fn record_prefetch(&self)
Record prefetch.
Sourcepub fn get_hot_data(&self) -> Vec<(String, u64)>
pub fn get_hot_data(&self) -> Vec<(String, u64)>
Get hot data (frequently accessed).
Sourcepub fn suggest_replication(&self) -> Vec<(String, usize)>
pub fn suggest_replication(&self) -> Vec<(String, usize)>
Suggest replication for hot data.
Sourcepub fn get_affinity(&self, data_key: &str) -> Vec<WorkerId>
pub fn get_affinity(&self, data_key: &str) -> Vec<WorkerId>
Get affinity for data.
Sourcepub fn remove_worker(&self, worker_id: WorkerId) -> Result<()>
pub fn remove_worker(&self, worker_id: WorkerId) -> Result<()>
Remove worker from all data tracking.
Sourcepub fn get_statistics(&self) -> LocalityStats
pub fn get_statistics(&self) -> LocalityStats
Get locality statistics.
Sourcepub fn reset_statistics(&self)
pub fn reset_statistics(&self)
Reset statistics.
Trait Implementations§
Source§impl Clone for DataLocalityOptimizer
impl Clone for DataLocalityOptimizer
Source§fn clone(&self) -> DataLocalityOptimizer
fn clone(&self) -> DataLocalityOptimizer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DataLocalityOptimizer
impl !RefUnwindSafe for DataLocalityOptimizer
impl Send for DataLocalityOptimizer
impl Sync for DataLocalityOptimizer
impl Unpin for DataLocalityOptimizer
impl UnsafeUnpin for DataLocalityOptimizer
impl !UnwindSafe for DataLocalityOptimizer
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
Mutably borrows from an owned value. Read more