pub struct ExactProductCache { /* private fields */ }Expand description
One exact identity/source cache rooted at the caller’s stable product path.
Implementations§
Source§impl ExactProductCache
impl ExactProductCache
Sourcepub fn new(
stable_path: impl Into<PathBuf>,
identity: ProductIdentity,
source: DistributionSource,
) -> Result<Self, ExactCacheError>
pub fn new( stable_path: impl Into<PathBuf>, identity: ProductIdentity, source: DistributionSource, ) -> Result<Self, ExactCacheError>
Create a cache handle after validating the complete identity.
Sourcepub fn stable_path(&self) -> &Path
pub fn stable_path(&self) -> &Path
Stable caller-facing path used to locate this cache entry.
Sourcepub fn open_single_flight(
&self,
options: ExactCacheSingleFlightOptions,
) -> Result<ExactCacheOpen, ExactCacheError>
pub fn open_single_flight( &self, options: ExactCacheSingleFlightOptions, ) -> Result<ExactCacheOpen, ExactCacheError>
Open this cache with bounded single-flight miss coalescing.
A hit contains bytes verified by the unchanged schema-v3 commit protocol. Only the returned owner should perform acquisition.
Sourcepub fn lock(
&self,
timeout: Duration,
) -> Result<ExactCacheGuard, ExactCacheError>
pub fn lock( &self, timeout: Duration, ) -> Result<ExactCacheGuard, ExactCacheError>
Acquire the per-entry cross-process lock with bounded waiting.
Sourcepub fn read(&self) -> Result<Option<CommittedExactCacheEntry>, ExactCacheError>
pub fn read(&self) -> Result<Option<CommittedExactCacheEntry>, ExactCacheError>
Read and digest-verify the currently committed immutable entry.
Returns Ok(None) only when no commit marker exists. A malformed,
incomplete, or mismatched entry is an error, never a cache miss.
Sourcepub fn publish(
&self,
guard: &ExactCacheGuard,
product: &[u8],
archive: &[u8],
provenance: &[u8],
) -> Result<CommittedExactCacheEntry, ExactCacheError>
pub fn publish( &self, guard: &ExactCacheGuard, product: &[u8], archive: &[u8], provenance: &[u8], ) -> Result<CommittedExactCacheEntry, ExactCacheError>
Publish a complete validated candidate under the held entry lock.
Sourcepub fn cleanup_abandoned(
&self,
guard: &ExactCacheGuard,
) -> Result<(), ExactCacheError>
pub fn cleanup_abandoned( &self, guard: &ExactCacheGuard, ) -> Result<(), ExactCacheError>
Remove unreferenced transactions while holding the entry lock.
Trait Implementations§
Source§impl Clone for ExactProductCache
impl Clone for ExactProductCache
Source§fn clone(&self) -> ExactProductCache
fn clone(&self) -> ExactProductCache
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 Freeze for ExactProductCache
impl RefUnwindSafe for ExactProductCache
impl Send for ExactProductCache
impl Sync for ExactProductCache
impl Unpin for ExactProductCache
impl UnsafeUnpin for ExactProductCache
impl UnwindSafe for ExactProductCache
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.