Skip to main content

Record

Struct Record 

Source
pub struct Record {
    pub container: PathBuf,
    pub content_name: 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 content file digest this used to carry: the container records a CRC-32 for its content file 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 content file 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: PathBuf

Where 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.

§content_name: String

The content file’s name inside the container, which is also its name inside content/ and therefore what decides which application opens it.

§started: u64

When 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 content file’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: u64

How many write-backs this session has performed, which concept 6.2 shows beside the session.

§agreed: Option<u32>

The container’s content file 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 content file 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§

Source§

impl Clone for Record

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Record

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Record

Source§

impl PartialEq for Record

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Record

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more