ensure_file_db_synced

Function ensure_file_db_synced 

Source
pub fn ensure_file_db_synced(
    force: bool,
    max_age_days: u64,
) -> Result<bool, String>
Expand description

What: Attempt a best-effort synchronization of the pacman file database.

Inputs:

  • force: If true, sync regardless of timestamp. If false, only sync if stale.
  • max_age_days: Maximum age in days before considering the database stale (default: 7).

Output:

  • Returns Ok(true) if sync was performed, Ok(false) if sync was skipped (fresh DB), Err if sync failed.

ยงErrors

  • Returns Err when pacman -Fy command execution fails (I/O error)
  • Returns Err when pacman -Fy exits with non-zero status

Details:

  • Checks timestamp first if force is false, only syncing when stale.
  • Intended to reduce false negatives when later querying remote file lists.