ProcessManager

Struct ProcessManager 

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

ProcessManager provides asynchronous API for spawning and managing multiple processes.

The implementation relies on the Actor model architecture which benefits from high concurrency and scalability and loose-coupling between actors (units doing some work). ProcessManager is a main actor responsible for:

  • spawning new actors (eg. for sending/reading messages to/from user-defined processes),
  • forwarding messages between client and other actors.

All files needed to handle spawned processes are kept in user-specified directory, called further working directory. Each process has own, unique subdirectory (process directory) inside working directory, where ProcessManager creates files/named pipes used for communication, logging etc. If the process has been killed manually, then its process directory is removed immediately.

Each spawned process has its own ProcessId, which can be used to interact with it through ProcessManagerHandle. For convenience of interacting with one process, use a ProcessHandle wrapper.

Please note that once all manager handles are dropped, then all child processes will be killed and all process directories will be deleted.

Implementations§

Source§

impl ProcessManager

Source

pub fn spawn(working_directory: PathBuf) -> Result<ProcessManagerHandle, Error>

Spawns a new process manager task with a given working_directory, returning a handle associated with the manager’s task.

The Err value is returned, if provided working_directory is not a directory or is not writeable.

§Examples
let working_directory = PathBuf::from("/some/temp/path");
let handle = ProcessManager::spawn(working_directory).expect("Invalid working directory");

Trait Implementations§

Source§

impl Drop for ProcessManager

Source§

fn drop(&mut self)

Executes the destructor for this type. 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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V