Expand description
§Shared types and tuning constants for the bundle caches
The common pieces used by both
crate::server::post_bundle_caching and
crate::server::post_bundle_feedback_caching:
CachedBundle— bytes + optionalexpires_at. Live (still-mutating) bundles carry an expiry; sealed (immutable past-tense) bundles do not and stay cached until evicted by LRU pressure.GetCacheResult— lookup outcome:Miss,Hit,HitAndIssueToken(the latter triggering [hashiverse_lib::protocol::payload::payload::CacheRequestTokenV1] emission from the caller).CACHE_LOCATION_TTI(60 s) andCACHE_HIT_THRESHOLD(10) — the tuning that decides when a bundle is “hot enough” to justify asking callers to help replicate it further.
Structs§
- Cached
Bundle - One bundle (from one originator peer) held in the cache.
- GetCache
Result - Result returned to the dispatch handler by either cache’s
on_get.
Constants§
- CACHE_
HIT_ THRESHOLD - Number of hits on a placeholder entry before the server issues a CacheRequestToken.
Essentially: have we had this many requests in the last
CACHE_LOCATION_TTI? If so, start caching. - CACHE_
LOCATION_ TTI - TTI for all cache entries: if a location_id hasn’t been queried for a while, evict it entirely.
- CACHE_
REQUEST_ TOKEN_ TTL_ DURATION - CACHE_
REQUEST_ TOKEN_ TTL_ DURATION_ MILLIS - How long a CacheRequestToken is valid for (client must upload within this window).