struct FileId {
len: u64,
mtime: SystemTime,
ino: u64,
}Expand description
Enough of a file to say it is the same file, for a cache whose wrong answer is a corrupt block served as good data.
All three fields, and each one is load-bearing against a different way the bytes under a path change without the others noticing:
lenis the cheap one and catches a rewrite of a different size.mtimecatches a rewrite of the same size. Alone it is not enough, because a length-preserving write inside one filesystem mtime tick does not move it — seeSETTLED, which closes that by construction.inocatches a replacement, which is the case neither of the others can see.std::fs::copyon APFS isfcopyfile(COPYFILE_ALL)and preserves the source’s mtime to the nanosecond; so docp -p,rsync -a,tar -xpand every backup agent worth using. Restoring a block from a copy of itself therefore lands bytes this process never verified, at a path it has, under a length and an mtime it remembers. A new file gets a new inode, and that is the field that says so.
Keying on the inode instead would be worse than either: retention unlinks block directories continuously and an inode number is reusable the moment its last link goes, so a fresh table could be handed the number of an expired one and inherit its verdict. Composed, that is a non-issue — a reused inode would also have to arrive at the same path carrying the same length and the same mtime — and each field covers what the others miss.
Fields§
§len: u64§mtime: SystemTime§ino: u64Trait Implementations§
impl Copy for FileId
impl Eq for FileId
impl StructuralPartialEq for FileId
Auto Trait Implementations§
impl Freeze for FileId
impl RefUnwindSafe for FileId
impl Send for FileId
impl Sync for FileId
impl Unpin for FileId
impl UnsafeUnpin for FileId
impl UnwindSafe for FileId
Blanket Implementations§
impl<T> Allocation for T
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].