pub enum State {
NothingExtracted,
Unchanged,
Edited,
Diverged,
ContainerGone,
ContainerChanged {
recorded: String,
found: String,
},
Unreadable(String),
}Expand description
What a session left behind turned out to be.
Variants§
NothingExtracted
No content file in the session directory. The session died between being created and being filled, so there is nothing to recover and nothing to ask about.
Unchanged
The content file still matches the one in the container. Nothing was lost: clean up and say nothing.
Edited
The content file differs from the one in the container, and the container is still holding what this session last agreed with it about. So the difference is this session’s own edit and nobody else’s, and it goes back.
Diverged
The content file differs from the container and the container is not what it was when the two last agreed. Both sides moved.
The one case worth interrupting for. Writing back would throw away whatever changed the container, and discarding would throw away the edit; there is no answer here that is not somebody’s decision. It is also rare: it needs a second writer to the same container while this session was not running.
ContainerGone
The container is no longer where the session recorded it. Concept 6.4 requires surviving this rather than failing at the rename: the content file is still here, and the person can be offered somewhere else to put it.
ContainerChanged
Something is at the recorded path, and it is not the container this session was opened against — its content file goes by another name. Writing back would rename the content file of a container somebody else’s session may be holding.
Fields
Unreadable(String)
The container is there and cannot be read, or the content file cannot be. A question for a person rather than an answer.
Implementations§
Source§impl State
impl State
Sourcepub fn needs_a_person(&self) -> bool
pub fn needs_a_person(&self) -> bool
Whether a person has to be asked about this one.
Sourcepub fn is_ours_to_write_back(&self) -> bool
pub fn is_ours_to_write_back(&self) -> bool
Whether this one is recovery’s own to put back.