Skip to main content

check_sync_db_freshness

Function check_sync_db_freshness 

Source
pub fn check_sync_db_freshness(
    ctx: &GuardrailContext,
    now: SystemTime,
) -> Option<GuardrailIssue>
Expand description

What: Check whether the pacman sync databases are stale.

Inputs:

  • ctx: Guardrail context providing the sync directory and staleness window.
  • now: Reference time (injectable for tests).

Output:

  • Some(GuardrailIssue::SyncDbStale) when the newest *.db is older than the window.

Details:

  • Stale databases correlate with mirror/database drift (“partial upgrade” errors, 404s during download); the guidance is to refresh before mutating.
  • Returns None when the directory or usable mtimes are unavailable.