Process Class Reference

Space-ng SDK: sol3::process_manager::Process Class Reference
Space-ng SDK
sol3::process_manager::Process Class Reference

Manages the lifecycle of a single child process with restart capabilities. More...

#include <sol3/process_manager/process.h>

Inheritance diagram for sol3::process_manager::Process:

Public Member Functions

void asyncStart (bool reset_restart_count=false)
 Asynchronously starts the process without resetting restart count. More...
 
void asyncRestart (bool reset_restart_count=false)
 Asynchronously restarts the process without resetting restart count. More...
 
void asyncStop (std::optional< ExitHandler > on_exit={})
 Asynchronously stops the process and invokes a callback on exit. More...
 
void asyncSetLifecycleManagement (bool enabled)
 Asynchronously sets lifecycle management (auto-restart, etc.). More...
 
msg::ProcessTelemetryT telemetry () const
 Retrieves current process telemetry. More...
 
msg::ProcessConfigT const & config () const
 Retrieves current process config. More...
 

Static Public Member Functions

static std::shared_ptr< Processcreate (asio::Strand strand, msg::ProcessConfigT config, std::optional< ExitHandler > exit_handler={}, std::shared_ptr< IStdioContext > stdio_context={})
 Create a reference counted Process. More...
 

Detailed Description

Manages the lifecycle of a single child process with restart capabilities.

Process handles starting, stopping, restarting, and monitoring a child process. It supports automatic restarts on exit, lifecycle management control, and telemetry reporting. All operations are executed on a provided strand for thread safety.

Member Function Documentation

◆ asyncRestart()

void sol3::process_manager::Process::asyncRestart ( bool  reset_restart_count = false)

Asynchronously restarts the process without resetting restart count.

Parameters
reset_restart_countResets restart count.

◆ asyncSetLifecycleManagement()

void sol3::process_manager::Process::asyncSetLifecycleManagement ( bool  enabled)

Asynchronously sets lifecycle management (auto-restart, etc.).

Parameters
enabledWhether lifecycle management is enabled or disabled.

◆ asyncStart()

void sol3::process_manager::Process::asyncStart ( bool  reset_restart_count = false)

Asynchronously starts the process without resetting restart count.

Parameters
reset_restart_countResets restart count if process is started.

◆ asyncStop()

void sol3::process_manager::Process::asyncStop ( std::optional< ExitHandler on_exit = {})

Asynchronously stops the process and invokes a callback on exit.

Parameters
on_exitCallback to invoke when the process exits (optional).

◆ config()

msg::ProcessConfigT const& sol3::process_manager::Process::config ( ) const

Retrieves current process config.

Returns
Process config structure.

◆ create()

static std::shared_ptr<Process> sol3::process_manager::Process::create ( asio::Strand  strand,
msg::ProcessConfigT  config,
std::optional< ExitHandler exit_handler = {},
std::shared_ptr< IStdioContext stdio_context = {} 
)
static

Create a reference counted Process.

Parameters
strandThe strand used for execution. MUST BE RUN ON LONG LIVED THREAD.
configProcess configuration.
exit_handlersHandlers to run on every process exit (optional).
Returns
A shared pointer to the created Process.

◆ telemetry()

msg::ProcessTelemetryT sol3::process_manager::Process::telemetry ( ) const

Retrieves current process telemetry.

Returns
Process telemetry structure.
Note
Must be called from the strand context.

The documentation for this class was generated from the following file:
  • /workspaces/astro/sol3-sdk/cpp/sol3/process_manager/process.h