pub struct Recovery {
pub present: bool,
pub pointer: Pointer,
pub stranded: Vec<Stranded>,
pub orphans: Vec<Orphan>,
pub balance: Balance,
pub findings: Vec<String>,
}Expand description
What this checkout’s session store needs somebody to do.
findings is the whole report said once, and an empty findings is the verdict: there
is nothing to recover. That is the field to branch on — the three detailed lists and the
arithmetic are what a reader consults after deciding there is something to look at,
and each of them can be empty for a good reason while another is not.
use majordomus_cli::capability::builtin::lifecycle::Recovery;
use serde_json::json;
// a healthy checkout: the current layout, nothing stranded, the arithmetic agreeing
let clean: Recovery = serde_json::from_value(json!({
"present": true,
"pointer": {"layout": "pointer", "target": "sessions-open/c.yaml",
"resolves": true, "session_id": "s-1", "note": "resolves"},
"balance": {"started": 8, "closed": 7, "open": 1,
"unaccounted": 0, "agrees": true, "note": "they agree"},
})).unwrap();
assert!(clean.findings.is_empty(), "an empty findings list is the good verdict");
assert!(clean.stranded.is_empty() && clean.orphans.is_empty());
assert!(clean.balance.agrees);
// a fresh clone has no local half at all, which is also nothing to recover
let fresh: Recovery = serde_json::from_value(json!({
"present": false,
"pointer": {"layout": "absent", "resolves": false, "note": "no episode is open here"},
"balance": {"started": 0, "closed": 0, "open": 0,
"unaccounted": 0, "agrees": true, "note": "nothing has happened yet"},
})).unwrap();
assert!(!fresh.present && fresh.findings.is_empty());Fields§
§present: boolWhether the local half exists at all.
pointer: PointerThe pointer and its layout.
stranded: Vec<Stranded>Episodes that can no longer close themselves.
orphans: Vec<Orphan>Temporary files left in the tracked sessions section.
balance: BalanceThe started/closed/open arithmetic.
findings: Vec<String>Everything above, said once, for a reader that wants the summary. Empty is the good case and means there is nothing to recover.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Recovery
impl<'de> Deserialize<'de> for Recovery
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Recovery
Source§impl JsonSchema for Recovery
impl JsonSchema for Recovery
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreimpl StructuralPartialEq for Recovery
Auto Trait Implementations§
impl Freeze for Recovery
impl RefUnwindSafe for Recovery
impl Send for Recovery
impl Sync for Recovery
impl Unpin for Recovery
impl UnsafeUnpin for Recovery
impl UnwindSafe for Recovery
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
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<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§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.