Use a consistent Timestamp struct (#1081)

## Summary

This PR uses `ctime` consistently on Unix as a more conservative
approach to change detection. It also ensures that our timestamp
abstraction is entirely internal, so we can change the representation
and logic easily across the codebase in the future.
This commit is contained in:
Charlie Marsh 2024-01-24 11:21:31 -08:00 committed by GitHub
parent bdfabfb088
commit 738e8341e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 83 additions and 76 deletions

View file

@ -3,7 +3,6 @@
use std::path::{Path, PathBuf};
use std::str::FromStr;
use std::sync::Arc;
use std::time::SystemTime;
use anyhow::Result;
use fs_err::tokio as fs;
@ -950,7 +949,7 @@ pub(crate) fn read_timestamp_manifest(
// If the cache entry is up-to-date, return it.
match std::fs::read(cache_entry.path()) {
Ok(cached) => {
let cached = rmp_serde::from_slice::<CachedByTimestamp<SystemTime, Manifest>>(&cached)?;
let cached = rmp_serde::from_slice::<CachedByTimestamp<Manifest>>(&cached)?;
if cached.timestamp == modified.timestamp() {
return Ok(Some(cached.data));
}