pub struct FileIdentity {
pub path: PathBuf,
pub len: u64,
pub modified: SystemTime,
pub changed: Option<(i64, i64)>,
}Expand description
The on-disk identity a recorded file digest describes.
The same trade [VerifiedBlob] makes for CAS reads, offered to shims for
the files they hash: an overwrite moves the modification time and a
truncation changes the length, so a digest recorded against both stands
until either does. Where the platform reports a metadata-change time the
identity carries that too, and it is the part a writer cannot restore: a
rewrite that puts the modification time back still moves the change time,
so only filesystems without one fall back to the freshness model the
surrounding build tool already lives on.
Fields§
§path: PathBufAbsolute path of the file.
len: u64Length of the file in bytes.
modified: SystemTimeModification time of the file.
changed: Option<(i64, i64)>Platform metadata-change token, where one exists.
Implementations§
Source§impl FileIdentity
impl FileIdentity
Sourcepub fn describe(path: &Path, metadata: &Metadata) -> Option<Self>
pub fn describe(path: &Path, metadata: &Metadata) -> Option<Self>
Describe a file from metadata already in hand, or nothing when the filesystem reports no modification time to compare against later.
Sourcepub fn still_describes(&self) -> Result<bool>
pub fn still_describes(&self) -> Result<bool>
Whether the file at this identity’s path still has exactly this identity, so the digest recorded against it still describes the bytes on disk without reading them again.
Length alone would miss an overwrite that keeps the size, and the modification time can be put back by whoever rewrote the file. The change time cannot be set from user space, so where the platform reports one a rewrite that restores the old modification time still shows. A file that has vanished is an error rather than a change, so the caller can tell the two apart.
Trait Implementations§
Source§impl Clone for FileIdentity
impl Clone for FileIdentity
Source§fn clone(&self) -> FileIdentity
fn clone(&self) -> FileIdentity
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more