Skip to main content

CommandCustody

Struct CommandCustody 

Source
pub struct CommandCustody { /* private fields */ }
Expand description

One command’s inheritable sidecar custody, acquired without waiting.

Dropping closes the owner descriptor without unlocking inherited copies. Descendants must preserve that descriptor for their entire relevant lifetime.

Implementations§

Source§

impl CommandCustody

Source

pub fn acquire(path: &Path) -> Result<Self, CustodyError>

Open/create a private regular sidecar in an existing parent and try its lock.

Existing bytes and permissions are preserved. Creation is not synchronized. Only the final component is no-follow; callers trust and stabilize parents.

§Errors

Returns entry, lock contention and native I/O failures, retaining the sidecar.

Source

pub const fn identity(&self) -> FileIdentity

Read the observed identity for caller-owned retention before dispatch.

Source

pub fn path(&self) -> &Path

Read the caller-selected sidecar path.

Source

pub fn spawn( &mut self, command: Command, descriptor_environment: &str, ) -> Result<Child, CustodyError>

Attempt one command with a duplicated descriptor named by its environment.

Recheck the sidecar identity before consuming the single spawn allowance. Duplication and spawn failures consume that allowance too. The owner stays close-on-exec; the command’s parent-side copy is closed before returning. Callers own argv/environment admission, output bounds, deadlines and reaping.

§Errors

Returns replacement, repeated-dispatch, descriptor or spawn failures.

Source

pub fn finish( self, grace: Duration, poll_interval: Duration, ) -> Result<QuiescenceGuard, CustodyError>

Close owner custody and probe exact quiescence within caller-selected grace.

Retry only contention. A zero grace performs one probe; polling must be nonzero. Filesystem operations have no wall-clock deadline. Failure retains the original sidecar and establishes no remote outcome or retry authority.

§Errors

Returns invalid timing, active inherited holders, replacement or I/O failure.

Trait Implementations§

Source§

impl Debug for CommandCustody

Source§

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

Formats the value using the given formatter. Read more

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.