pub struct Record {
pub container: PathBuf,
pub payload: String,
pub started: u64,
pub write_backs: u64,
pub agreed: Option<u32>,
}Expand description
What a session remembers across a crash.
Deliberately small. Concept 6.3 removed the payload digest this used to carry: the container records a CRC-32 for its payload already, so recovery compares against the container rather than against a second copy of the fact that can drift from it — and drift is likeliest at the moment this file is consulted.
Record::agreed is not that digest coming back, and the difference is
worth being exact about. The removed one answered has the payload changed,
which the container can answer better. This one answers which side changed,
which nothing can answer without a record, because both sides are only
visible now and the question is about then. It is a note of a past moment
rather than a cached copy of a present fact, so there is nothing for it to
drift from: if it is stale, the answer it gives — that the container is not
where we left it — is the true one.
Fields§
§container: PathBufWhere the container was when the session opened, resolved. It may have moved or gone since, which concept 6.4 requires recovery to survive rather than fail at the rename.
payload: StringThe payload’s name inside the container, which is also its name inside
payload/ and therefore what decides which application opens it.
started: u64When the session opened, in seconds since the Unix epoch.
A number rather than a formatted timestamp, because nothing in the tool needs to render it: concept 6.3 shows a person the payload’s own modification time, which comes from the filesystem. Storing it this way keeps a date-formatting dependency out of a crate that would otherwise have no use for one.
write_backs: u64How many write-backs this session has performed, which concept 6.2 shows beside the session.
agreed: Option<u32>The container’s payload CRC-32 at the last moment this session and the container were known to agree: the extraction, or the most recent write-back.
What it is for is telling which side moved. A payload that differs from its container is either an edit that never landed or a container that changed underneath a dead session, and those want opposite treatment — the first is the person’s own work and goes back, the second is a conflict only they can settle. Comparing the two sides now cannot separate them, because both are only observable in the present.
None for a session written by a build that did not record it, and for
one whose container could not be read at the time. Recovery treats that
as not known to agree, which is the cautious direction: it asks.
Trait Implementations§
impl Eq for Record
impl StructuralPartialEq for Record
Auto Trait Implementations§
impl Freeze for Record
impl RefUnwindSafe for Record
impl Send for Record
impl Sync for Record
impl Unpin for Record
impl UnsafeUnpin for Record
impl UnwindSafe for Record
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§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.