pub enum StrayKind {
PublishTemp,
RenameTemp,
StagingDir,
}Expand description
What kind of stray a path is, decided by where it is and how it is named rather than by what is in it. The content decides the verdict; this decides which question to ask.
The word a kind is reported under is also the word it is read back from, and a word this version does not know is refused rather than read as the nearest kind:
use majordomus_cli::capability::builtin::recover::StrayKind;
for kind in [StrayKind::PublishTemp, StrayKind::RenameTemp, StrayKind::StagingDir] {
let word = serde_json::to_value(kind).unwrap();
assert_eq!(serde_json::from_value::<StrayKind>(word).unwrap(), kind);
}
assert!(serde_json::from_value::<StrayKind>(serde_json::json!("temp")).is_err());Variants§
PublishTemp
A .tmp.XXXXXX in a record store: mj_publish_record makes them, and only a process
that died between the mktemp and the rm leaves one.
RenameTemp
A <target>.mj-tmp: written and renamed in one &&, so one that exists means the
write failed or the process died mid-write.
StagingDir
A .mj-stage.XXXXXX at the repository root: scripts/generate-site-data stages into
one. Always a directory, and therefore never removed here.
Implementations§
Source§impl StrayKind
impl StrayKind
Sourcepub fn as_str(self) -> &'static str
pub fn as_str(self) -> &'static str
The word this kind is reported and serialised under.
use majordomus_cli::capability::builtin::recover::StrayKind;
assert_eq!(StrayKind::PublishTemp.as_str(), "publish_temp");
assert_eq!(
serde_json::to_value(StrayKind::StagingDir).unwrap(),
serde_json::json!(StrayKind::StagingDir.as_str()),
);Trait Implementations§
impl Copy for StrayKind
Source§impl<'de> Deserialize<'de> for StrayKind
impl<'de> Deserialize<'de> for StrayKind
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>,
impl Eq for StrayKind
Source§impl JsonSchema for StrayKind
impl JsonSchema for StrayKind
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Ord for StrayKind
impl Ord for StrayKind
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for StrayKind
impl PartialOrd for StrayKind
impl StructuralPartialEq for StrayKind
Auto Trait Implementations§
impl Freeze for StrayKind
impl RefUnwindSafe for StrayKind
impl Send for StrayKind
impl Sync for StrayKind
impl Unpin for StrayKind
impl UnsafeUnpin for StrayKind
impl UnwindSafe for StrayKind
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
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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
key and return true if they are equal.