pub struct PredictivePrefetcher<S: BlockStore> { /* private fields */ }Expand description
Predictive prefetcher
Implementations§
Source§impl<S: BlockStore + Send + Sync + 'static> PredictivePrefetcher<S>
impl<S: BlockStore + Send + Sync + 'static> PredictivePrefetcher<S>
Sourcepub fn new(store: Arc<S>, config: PrefetchConfig) -> Self
pub fn new(store: Arc<S>, config: PrefetchConfig) -> Self
Create a new predictive prefetcher
Sourcepub fn record_access(&self, cid: &Cid)
pub fn record_access(&self, cid: &Cid)
Record an access and update patterns
Sourcepub fn predict_next_blocks(&self, current_cid: &Cid) -> Vec<PrefetchPrediction>
pub fn predict_next_blocks(&self, current_cid: &Cid) -> Vec<PrefetchPrediction>
Predict next blocks to access
Sourcepub async fn prefetch_background(&self, predictions: Vec<PrefetchPrediction>)
pub async fn prefetch_background(&self, predictions: Vec<PrefetchPrediction>)
Prefetch predicted blocks in background
Sourcepub fn adapt_depth(&self)
pub fn adapt_depth(&self)
Adapt prefetch depth based on hit rate
Sourcepub fn stats(&self) -> PrefetchStatsSnapshot
pub fn stats(&self) -> PrefetchStatsSnapshot
Get statistics
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clear prefetch cache
Sourcepub fn cache_size(&self) -> usize
pub fn cache_size(&self) -> usize
Get cache size
Auto Trait Implementations§
impl<S> !Freeze for PredictivePrefetcher<S>
impl<S> !RefUnwindSafe for PredictivePrefetcher<S>
impl<S> Send for PredictivePrefetcher<S>
impl<S> Sync for PredictivePrefetcher<S>
impl<S> Unpin for PredictivePrefetcher<S>
impl<S> !UnwindSafe for PredictivePrefetcher<S>
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
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>
Converts
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>
Converts
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