pub enum FetchPolicy {
CacheFirst,
Refresh,
AcceptUpstreamChange,
}Expand description
How a fetch treats an existing cache hit (D-02, D-09). All three behave IDENTICALLY on a cache MISS — the miss path (resolve, download, verify, persist) is implemented exactly once and is reached by every policy alike.
On a cache HIT, a re-released version upstream is refused BY
DEFAULT: if the digest the feed publishes today differs from what’s
cached for this version, the fetch refuses naming both digests and
leaves the cached artifact usable and untouched.
AcceptUpstreamChange is the deliberate, explicit way to accept
that change — it downloads the new bytes and verifies them against
the NEWLY published digest before caching them ALONGSIDE (never
over) the old entry. Phase 16 wires these to a CLI flag.
Variants§
CacheFirst
Trust an existing cache hit outright — never re-contact the feed for a version already cached. The default.
Refresh
Re-verify a cache hit against the feed’s current digest before
trusting it: an unchanged digest reuses the cache (no
re-download); a changed digest is REFUSED
(module_digest_changed, exit 6), naming both digests, with
the cached artifact left exactly as it was (15-02).
AcceptUpstreamChange
Accept a digest change the feed now reports for an already-cached version: downloads the new bytes and verifies them against the NEWLY published digest — never trusts them unverified — then persists them alongside (not over) the existing cache entry (15-02, D-02’s explicit override).
Trait Implementations§
Source§impl Clone for FetchPolicy
impl Clone for FetchPolicy
impl Copy for FetchPolicy
Source§impl Debug for FetchPolicy
impl Debug for FetchPolicy
Source§impl Default for FetchPolicy
impl Default for FetchPolicy
impl Eq for FetchPolicy
Source§impl PartialEq for FetchPolicy
impl PartialEq for FetchPolicy
impl StructuralPartialEq for FetchPolicy
Auto Trait Implementations§
impl Freeze for FetchPolicy
impl RefUnwindSafe for FetchPolicy
impl Send for FetchPolicy
impl Sync for FetchPolicy
impl Unpin for FetchPolicy
impl UnsafeUnpin for FetchPolicy
impl UnwindSafe for FetchPolicy
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.