pub struct PackageCacheLayer { /* private fields */ }Implementations§
Source§impl PackageCacheLayer
impl PackageCacheLayer
Sourcepub fn new(path: impl Into<PathBuf>) -> Self
pub fn new(path: impl Into<PathBuf>) -> Self
Creates an unfiltered package-cache layer with default validation.
Sourcepub fn with_validation_mode(self, validation_mode: ValidationMode) -> Self
pub fn with_validation_mode(self, validation_mode: ValidationMode) -> Self
Sets the validation mode used by this layer.
Sourcepub fn with_filter(self, spec: MatchSpec) -> Self
pub fn with_filter(self, spec: MatchSpec) -> Self
Adds an inclusion MatchSpec to this layer.
Multiple inclusion specifications are combined with OR. If no inclusion specification is configured, all packages are included.
Sourcepub fn excluding(self, spec: MatchSpec) -> Self
pub fn excluding(self, spec: MatchSpec) -> Self
Excludes packages matching spec from this layer.
Exclusions take precedence over inclusion specifications.
Sourcepub fn accepts(&self, cache_key: &CacheKey) -> bool
pub fn accepts(&self, cache_key: &CacheKey) -> bool
Returns whether this layer accepts cache_key.
Sourcepub fn is_readonly(&self) -> bool
pub fn is_readonly(&self) -> bool
Determine if the layer is read-only in the filesystem
Sourcepub async fn try_validate(
&self,
cache_key: &CacheKey,
) -> Result<CacheMetadata, PackageCacheLayerError>
pub async fn try_validate( &self, cache_key: &CacheKey, ) -> Result<CacheMetadata, PackageCacheLayerError>
Validate the packages.
An entry this cache object has not touched before is validated from
disk, just as Self::validate_or_fetch would: layers hold entries
written by other processes or earlier runs, and a lookup that only
believed its own in-memory bookkeeping would refetch all of those.
Sourcepub async fn validate_or_fetch<F, Fut, E>(
&self,
fetch: F,
cache_key: &CacheKey,
reporter: Option<Arc<dyn CacheReporter>>,
) -> Result<CacheMetadata, PackageCacheLayerError>
pub async fn validate_or_fetch<F, Fut, E>( &self, fetch: F, cache_key: &CacheKey, reporter: Option<Arc<dyn CacheReporter>>, ) -> Result<CacheMetadata, PackageCacheLayerError>
Validate the package, and fetch it if invalid.
Trait Implementations§
Source§impl Clone for PackageCacheLayer
impl Clone for PackageCacheLayer
Source§fn clone(&self) -> PackageCacheLayer
fn clone(&self) -> PackageCacheLayer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for PackageCacheLayer
impl !UnwindSafe for PackageCacheLayer
impl Freeze for PackageCacheLayer
impl Send for PackageCacheLayer
impl Sync for PackageCacheLayer
impl Unpin for PackageCacheLayer
impl UnsafeUnpin for PackageCacheLayer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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