Skip to main content

Module db_snapshot

Module db_snapshot 

Source
Expand description

Generic whole-table snapshot cache shared by the audience-grant and group stores Generic whole-table snapshot cache, extracted from what used to be db_audience_grants.rs’s entire cache-mechanics implementation. crate::db_snapshot::SnapshotLoader is the one thing each store (audience grants, groups) supplies: how to fetch a fresh snapshot and which metric/name to report on a refresh failure. crate::db_snapshot::SnapshotSource is everything else – cold-start throttling, last-good serving after the first success, ProviderUnavailable wrapping – copied unchanged from the original DbAudienceGrantsSource.

Modeled on db_api_key.rs’s config/pool conventions, but a single cached value rather than a per-key moka cache: the whole table is small enough to hold as one snapshot, so moka’s eviction/LRU machinery has nothing to do here.

Structs§

SnapshotSource
The whole-table snapshot cache described in the module doc comment, generic over a SnapshotLoader.

Traits§

SnapshotLoader
What a SnapshotSource needs from a specific store: how to fetch a fresh snapshot from the pool, and the name/metric to report on a refresh failure.