pub struct StatCacheEntry {
pub mtime_ns: i64,
pub ctime_ns: i64,
pub size: i64,
pub blob_hash: Hash,
}Expand description
A working-tree stat-cache row: the blob hash a file produced the last time
it was scanned, keyed (by the caller) on its path and validated by (mtime_ns, ctime_ns, size). If a file’s mtime, ctime, and size all match a cached row,
the scan can reuse blob_hash instead of re-reading and re-hashing the file —
the same trick git’s index uses to keep status cheap on large trees.
ctime_ns (inode change time) is the guard against a forged (mtime, size):
any content write bumps ctime, and so does an mtime reset (touch, utime,
a checkout), because the metadata-update syscall itself touches ctime — and
ctime can’t be set backwards from userspace. Without it, an edit that keeps
the size and reuses an old mtime (same-second clock, rapid edits, explicit
reset) looks unchanged and the change is silently dropped by status, diff,
AND commit. ctime_ns is 0 on platforms with no POSIX ctime (e.g. Windows),
where the hit check degrades to the previous (mtime, size) behavior.
Fields§
§mtime_ns: i64Modification time in nanoseconds since the Unix epoch.
ctime_ns: i64Inode change time (ctime) in nanoseconds since the Unix epoch, or 0 when the platform can’t report one.
size: i64File size in bytes.
blob_hash: HashThe blob hash this file content produced when last hashed.
Trait Implementations§
Source§impl Clone for StatCacheEntry
impl Clone for StatCacheEntry
Source§impl Debug for StatCacheEntry
impl Debug for StatCacheEntry
impl Eq for StatCacheEntry
Source§impl PartialEq for StatCacheEntry
impl PartialEq for StatCacheEntry
impl StructuralPartialEq for StatCacheEntry
Auto Trait Implementations§
impl Forget for StatCacheEntry
impl Freeze for StatCacheEntry
impl Move for StatCacheEntry
impl RefUnwindSafe for StatCacheEntry
impl Send for StatCacheEntry
impl Sync for StatCacheEntry
impl Unpin for StatCacheEntry
impl UnsafeUnpin for StatCacheEntry
impl UnwindSafe for StatCacheEntry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more