pub struct FileStatFingerprint { /* private fields */ }Expand description
A snapshot of the filesystem identity and size of a committed file.
This is captured while constructing CommittedFileEvidence and can be
compared by callers before trusting that the committed path still names the
file whose checksums were recorded.
Implementations§
Source§impl FileStatFingerprint
impl FileStatFingerprint
Sourcepub fn capture_path(path: impl AsRef<Path>) -> Option<Self>
pub fn capture_path(path: impl AsRef<Path>) -> Option<Self>
Fingerprint path exactly as this crate’s stat gates compare it.
Symlinks are not followed and only regular files fingerprint, so a path
that is (or became) a directory, a symlink or a device reads as None
rather than as a file — the same rule the carry gate applies, because
this is the function that gate calls.
Callers building a crate::ScanCarry from their own verification pass
must capture the fingerprint at the moment they read the file’s bytes,
not afterwards: the gate’s whole guarantee is that the file the repair
reads is the file the fingerprint describes, and a fingerprint taken
late silently covers whatever changed in between.
What this can prove is what stat can prove — length, mtime, and on
Unix device and inode. A same-length rewrite that also restores the
original mtime in place is invisible to it, which is why a repair that
consumes a carry re-checks the bytes themselves against their slice
checksums as it reads them.
Sourcepub fn modified(&self) -> Option<SystemTime>
pub fn modified(&self) -> Option<SystemTime>
Last-modified timestamp recorded by the stat call, when available.
Trait Implementations§
Source§impl Clone for FileStatFingerprint
impl Clone for FileStatFingerprint
Source§fn clone(&self) -> FileStatFingerprint
fn clone(&self) -> FileStatFingerprint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FileStatFingerprint
impl Debug for FileStatFingerprint
impl Eq for FileStatFingerprint
Source§impl PartialEq for FileStatFingerprint
impl PartialEq for FileStatFingerprint
impl StructuralPartialEq for FileStatFingerprint
Auto Trait Implementations§
impl Freeze for FileStatFingerprint
impl RefUnwindSafe for FileStatFingerprint
impl Send for FileStatFingerprint
impl Sync for FileStatFingerprint
impl Unpin for FileStatFingerprint
impl UnsafeUnpin for FileStatFingerprint
impl UnwindSafe for FileStatFingerprint
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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