Skip to main content

DaemonProcess

Struct DaemonProcess 

Source
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: u32

Operating-system process ID.

§exe_path: PathBuf

Executable path recorded when the daemon identity was written.

§exe_sha256: [u8; 32]

SHA-256 of the daemon executable.

§boot_id: String

Host boot ID observed when the daemon started.

§ipc_endpoint: Endpoint

IPC endpoint used to connect to the daemon.

§started_at_unix_ms: u64

Daemon start timestamp in Unix milliseconds.

§idle_timeout_secs: Option<u32>

Optional idle timeout advertised by the daemon.

Implementations§

Source§

impl DaemonProcess

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> DaemonProcess

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DaemonProcess

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for DaemonProcess

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for DaemonProcess

Source§

impl From<&DaemonProcess> for DaemonProcess

Source§

fn from(value: &DaemonProcess) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for DaemonProcess

Source§

fn eq(&self, other: &DaemonProcess) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for DaemonProcess

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for DaemonProcess

Source§

impl TryFrom<DaemonProcess> for DaemonProcess

Source§

type Error = IdentityError

The type returned in the event of a conversion error.
Source§

fn try_from(value: DaemonProcess) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> TryClone for T
where T: Clone,

Source§

fn try_clone(&self) -> Result<T, Error>

Clones self, possibly returning an error.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.