pub struct ProviderCatalogCache {
pub entries: BTreeMap<String, CachedProviderCatalog>,
}Expand description
A secret-free store of cached provider catalogs, keyed by provider + base-URL fingerprint.
Scoping rule (#3385): the SAME provider on DIFFERENT base URLs must not share rows, and DIFFERENT providers on the same base URL must not share rows.
Fields§
§entries: BTreeMap<String, CachedProviderCatalog>Entries keyed by ProviderCatalogCache::cache_key.
Implementations§
Source§impl ProviderCatalogCache
impl ProviderCatalogCache
Sourcepub fn cache_key(provider: &str, base_url_fingerprint: &str) -> String
pub fn cache_key(provider: &str, base_url_fingerprint: &str) -> String
Compute the composite cache key for a provider + base-URL fingerprint.
Sourcepub fn get(
&self,
provider: &str,
base_url_fingerprint: &str,
) -> Option<&CachedProviderCatalog>
pub fn get( &self, provider: &str, base_url_fingerprint: &str, ) -> Option<&CachedProviderCatalog>
Look up a cached entry by provider + base-URL fingerprint.
Sourcepub fn record_success(&mut self, delta: ProviderCatalogDelta, ttl_secs: u64)
pub fn record_success(&mut self, delta: ProviderCatalogDelta, ttl_secs: u64)
Record a successful refresh, replacing any prior entry for this scope.
Offering sources are normalized to CatalogSource::Live with the
delta’s fingerprint and fetched_at, so cached rows always carry honest
provenance regardless of how the delta was assembled.
Sourcepub fn record_failure(
&mut self,
provider: &str,
base_url_fingerprint: &str,
reason: CatalogRefreshError,
)
pub fn record_failure( &mut self, provider: &str, base_url_fingerprint: &str, reason: CatalogRefreshError, )
Record a refresh failure.
Previously cached rows for this scope are preserved (so the UI can still
offer them with a visible “stale/failed” status); only the status is
updated. When no prior entry exists, an empty Failed entry is created so
the failure is observable.
Sourcepub fn status(
&self,
provider: &str,
base_url_fingerprint: &str,
now_unix: u64,
) -> CatalogStatus
pub fn status( &self, provider: &str, base_url_fingerprint: &str, now_unix: u64, ) -> CatalogStatus
The resolved status of an entry at now_unix.
A Fresh-recorded entry that has since aged past its TTL reports
Stale; Failed/Unknown are returned as stored.
Sourcepub fn fresh_offerings(
&self,
provider: &str,
base_url_fingerprint: &str,
now_unix: u64,
) -> Vec<CatalogOffering>
pub fn fresh_offerings( &self, provider: &str, base_url_fingerprint: &str, now_unix: u64, ) -> Vec<CatalogOffering>
Fresh (within-TTL) live offerings for one provider + base URL at
now_unix. Stale or failed entries contribute nothing here; callers fall
back to bundled/configured rows and surface the status separately.
Sourcepub fn all_fresh_offerings(&self, now_unix: u64) -> Vec<CatalogOffering>
pub fn all_fresh_offerings(&self, now_unix: u64) -> Vec<CatalogOffering>
All fresh live offerings across every cached provider + base URL.
Trait Implementations§
Source§impl Clone for ProviderCatalogCache
impl Clone for ProviderCatalogCache
Source§fn clone(&self) -> ProviderCatalogCache
fn clone(&self) -> ProviderCatalogCache
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProviderCatalogCache
impl Debug for ProviderCatalogCache
Source§impl Default for ProviderCatalogCache
impl Default for ProviderCatalogCache
Source§fn default() -> ProviderCatalogCache
fn default() -> ProviderCatalogCache
Source§impl<'de> Deserialize<'de> for ProviderCatalogCache
impl<'de> Deserialize<'de> for ProviderCatalogCache
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ProviderCatalogCache
impl PartialEq for ProviderCatalogCache
Source§fn eq(&self, other: &ProviderCatalogCache) -> bool
fn eq(&self, other: &ProviderCatalogCache) -> bool
self and other values to be equal, and is used by ==.