pub struct DaemonProcess {
pub pid: u32,
pub exe_path: PathBuf,
pub exe_sha256: [u8; 32],
pub boot_id: String,
pub ipc_endpoint: Endpoint,
pub started_at_unix_ms: u64,
pub idle_timeout_secs: Option<u32>,
}Expand description
A backend daemon identity with fixed-width fields suitable for verification.
This mirrors CacheManifest.current_daemon, but normalizes protobuf strings
and byte vectors into path and digest types that are harder to misuse.
Persist this value only after the daemon has selected its final IPC endpoint
and executable. Later consumers can pass the same identity to
crate::broker::backend_handle::BackendHandle::probe or store it as
CacheManifest.current_daemon.
use running_process::broker::backend_handle::DaemonProcess;
use running_process::broker::protocol::{CacheManifest, Endpoint};
let endpoint = Endpoint {
namespace_id: "host-namespace".to_owned(),
path: "running-process-backend.sock".to_owned(),
};
let daemon = DaemonProcess::current_process(endpoint, Some(600))?;
manifest.current_daemon = Some(daemon.to_proto());Fields§
§pid: u32Operating-system process ID.
exe_path: PathBufExecutable path recorded when the daemon identity was written.
exe_sha256: [u8; 32]SHA-256 of the daemon executable.
boot_id: StringHost boot ID observed when the daemon started.
ipc_endpoint: EndpointIPC endpoint used to connect to the daemon.
started_at_unix_ms: u64Daemon start timestamp in Unix milliseconds.
idle_timeout_secs: Option<u32>Optional idle timeout advertised by the daemon.
Implementations§
Source§impl DaemonProcess
impl DaemonProcess
Sourcepub fn current_process(
ipc_endpoint: Endpoint,
idle_timeout_secs: Option<u32>,
) -> Result<Self, IdentityError>
pub fn current_process( ipc_endpoint: Endpoint, idle_timeout_secs: Option<u32>, ) -> Result<Self, IdentityError>
Build a daemon identity for the current process.
This is primarily useful for tests and direct-daemon consumers that have just spawned a backend and need to persist a manifest entry.
The executable digest is taken from std::env::current_exe() at the time
this method runs. If a daemon relocates or replaces its executable after
startup, record the final identity after relocation instead.
Sourcepub fn to_proto(&self) -> DaemonProcess
pub fn to_proto(&self) -> DaemonProcess
Convert this identity into the protobuf form stored in CacheManifest.
The conversion preserves the fixed-width SHA-256 value as bytes for the wire schema.
Sourcepub fn from_manifest_current_daemon(
manifest: &CacheManifest,
) -> Result<Option<Self>, IdentityError>
pub fn from_manifest_current_daemon( manifest: &CacheManifest, ) -> Result<Option<Self>, IdentityError>
Read and normalize CacheManifest.current_daemon.
Returns Ok(None) when the manifest has no daemon entry. Malformed
entries, such as a missing endpoint or non-32-byte executable digest,
return an IdentityError.
Trait Implementations§
Source§impl Clone for DaemonProcess
impl Clone for DaemonProcess
Source§fn clone(&self) -> DaemonProcess
fn clone(&self) -> DaemonProcess
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DaemonProcess
impl Debug for DaemonProcess
Source§impl<'de> Deserialize<'de> for DaemonProcess
impl<'de> Deserialize<'de> for DaemonProcess
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 DaemonProcess
Source§impl From<&DaemonProcess> for DaemonProcess
impl From<&DaemonProcess> for DaemonProcess
Source§fn from(value: &DaemonProcess) -> Self
fn from(value: &DaemonProcess) -> Self
Source§impl PartialEq for DaemonProcess
impl PartialEq for DaemonProcess
Source§fn eq(&self, other: &DaemonProcess) -> bool
fn eq(&self, other: &DaemonProcess) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for DaemonProcess
impl Serialize for DaemonProcess
impl StructuralPartialEq for DaemonProcess
Source§impl TryFrom<DaemonProcess> for DaemonProcess
impl TryFrom<DaemonProcess> for DaemonProcess
Source§type Error = IdentityError
type Error = IdentityError
Auto Trait Implementations§
impl Freeze for DaemonProcess
impl RefUnwindSafe for DaemonProcess
impl Send for DaemonProcess
impl Sync for DaemonProcess
impl Unpin for DaemonProcess
impl UnsafeUnpin for DaemonProcess
impl UnwindSafe for DaemonProcess
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
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>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more