pub struct ExecutableIdentity {
pub path: PathBuf,
pub mtime: u64,
pub size: u64,
}Expand description
The identity of the file an executable was started from: where it is, and the mtime and size of the file at that path. A server outlives its own binary — a rebuild replaces the file under a process that keeps serving the code it loaded hours ago — and nothing about the process itself says so. This is what makes that visible.
use majordomus_cli::lease::ExecutableIdentity;
let recorded = ExecutableIdentity { path: "/opt/majordomus".into(), mtime: 1_700_000_000, size: 42 };
let text = serde_json::to_string(&recorded).unwrap();
assert_eq!(serde_json::from_str::<ExecutableIdentity>(&text).unwrap(), recorded);Fields§
§path: PathBufThe path the process was started from.
mtime: u64The file’s modification time, seconds since the epoch.
size: u64The file’s size in bytes.
Implementations§
Source§impl ExecutableIdentity
impl ExecutableIdentity
Sourcepub fn replaced(&self) -> Option<String>
pub fn replaced(&self) -> Option<String>
Has the file at the recorded path been replaced or removed since it was recorded?
The reason, for a reader; None when the same file is still there.
use majordomus_cli::lease::ExecutableIdentity;
let gone = ExecutableIdentity { path: "/nowhere/majordomus".into(), mtime: 1, size: 1 };
assert!(gone.replaced().unwrap().contains("no longer on disk"));Trait Implementations§
Source§impl Clone for ExecutableIdentity
impl Clone for ExecutableIdentity
Source§fn clone(&self) -> ExecutableIdentity
fn clone(&self) -> ExecutableIdentity
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExecutableIdentity
impl Debug for ExecutableIdentity
Source§impl<'de> Deserialize<'de> for ExecutableIdentity
impl<'de> Deserialize<'de> for ExecutableIdentity
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 ExecutableIdentity
Source§impl JsonSchema for ExecutableIdentity
impl JsonSchema for ExecutableIdentity
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 moreSource§impl PartialEq for ExecutableIdentity
impl PartialEq for ExecutableIdentity
Source§fn eq(&self, other: &ExecutableIdentity) -> bool
fn eq(&self, other: &ExecutableIdentity) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ExecutableIdentity
impl Serialize for ExecutableIdentity
impl StructuralPartialEq for ExecutableIdentity
Auto Trait Implementations§
impl Freeze for ExecutableIdentity
impl RefUnwindSafe for ExecutableIdentity
impl Send for ExecutableIdentity
impl Sync for ExecutableIdentity
impl Unpin for ExecutableIdentity
impl UnsafeUnpin for ExecutableIdentity
impl UnwindSafe for ExecutableIdentity
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.