lintel 0.2.0
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
lintel::ProcessService Class Reference

#include <ProcessService.h>

Inheritance diagram for lintel::ProcessService:
lintel::PropertyRegistration< ProcessService > lintel::AbstractService< T > lintel::AbstractServiceInterface

Public Member Functions

 ProcessService (std::shared_ptr< ProcessName > processName, std::shared_ptr< EnvironmentConfiguration > environmentConfiguration, std::shared_ptr< Configuration > configuration, std::shared_ptr< IHistoryService > historyService)
 
 ~ProcessService () override
 
std::vector< ProcessGroupDto > allGroupsOf (const std::string &name)
 
std::vector< ProcessInfo > allActiveOf ()
 
ProcessInfo currentOf ()
 
std::optional< std::shared_ptr< Process > > of (const std::string &id)
 
std::optional< std::future< int > > startOf (const Process &process)
 
void restartOf (const Process &process)
 
bool stopOf (const Process &process)
 
void terminateOf (const Process &process)
 
void detachOf (const Process &process)
 
void resetOf (const Process &process)
 
void startOf (const ProcessGroup &processGroup)
 
void restartOf (const ProcessGroup &processGroup)
 
bool stopOf (const ProcessGroup &processGroup)
 
void terminateOf (const ProcessGroup &processGroup)
 
void detachOf (const ProcessGroup &processGroup)
 
bool isLastProcess ()
 
ShutdownPriority shutdownPriorityOf () const override
 
void onInitialize () override
 
- Public Member Functions inherited from lintel::AbstractService< T >
 AbstractService ()=delete
 
 AbstractService (std::string processName, std::string instanceName)
 
 AbstractService (std::string processName)
 
void onShutdown () override
 
const std::string & getProcessName () const override
 
const std::string & getInstanceName () const override
 
std::string_view getClassName () const override
 
- Public Member Functions inherited from lintel::AbstractServiceInterface
virtual ~AbstractServiceInterface ()=default
 

Additional Inherited Members

- Protected Member Functions inherited from lintel::PropertyRegistration< ProcessService >
std::shared_ptr< Property< type > > registerProperty (std::string name, type defaultValue, std::string description, bool runtime, const std::string &fileName, int32_t position)
 
- Protected Attributes inherited from lintel::AbstractService< T >
std::vector< std::shared_ptr< PropertyBase > > m_properties
 

Detailed Description

Service for managing process execution, monitoring, and process groups.

Constructor & Destructor Documentation

◆ ProcessService()

lintel::ProcessService::ProcessService ( std::shared_ptr< ProcessName >  processName,
std::shared_ptr< EnvironmentConfiguration >  environmentConfiguration,
std::shared_ptr< Configuration >  configuration,
std::shared_ptr< IHistoryService >  historyService 
)

Construct a ProcessService.

Parameters
processNamethe process name
environmentConfigurationthe environment configuration
configurationthe application configuration
historyServicethe process history service

◆ ~ProcessService()

lintel::ProcessService::~ProcessService ( )
override

Member Function Documentation

◆ allActiveOf()

std::vector< ProcessInfo > lintel::ProcessService::allActiveOf ( )

Returns information for all active processes.

Returns
list of active process info

◆ allGroupsOf()

std::vector< ProcessGroupDto > lintel::ProcessService::allGroupsOf ( const std::string &  name)

Returns all process groups matching the given name.

Parameters
namethe group name to search for
Returns
list of matching process group DTOs

◆ currentOf()

ProcessInfo lintel::ProcessService::currentOf ( )

Returns the current process information.

Returns
the current process info

◆ detachOf() [1/2]

void lintel::ProcessService::detachOf ( const Process &  process)

Detach from a running process without stopping it.

Parameters
processthe process to detach

◆ detachOf() [2/2]

void lintel::ProcessService::detachOf ( const ProcessGroup &  processGroup)

Detach from all processes in the given group.

Parameters
processGroupthe group to detach

◆ isLastProcess()

bool lintel::ProcessService::isLastProcess ( )

Check if this is the last running process in the application.

Returns
true if this is the last process

◆ of()

std::optional< std::shared_ptr< Process > > lintel::ProcessService::of ( const std::string &  id)

Returns the process with the given ID, if it exists.

Parameters
idthe process ID
Returns
the process, or std::nullopt if not found

◆ onInitialize()

void lintel::ProcessService::onInitialize ( )
overridevirtual

Default initialization does nothing; override in subclasses.

Reimplemented from lintel::AbstractService< T >.

◆ resetOf()

void lintel::ProcessService::resetOf ( const Process &  process)

Reset the restart counter and failure state of a process.

Parameters
processthe process to reset

◆ restartOf() [1/2]

void lintel::ProcessService::restartOf ( const Process &  process)

Restart a running process.

Parameters
processthe process to restart

◆ restartOf() [2/2]

void lintel::ProcessService::restartOf ( const ProcessGroup &  processGroup)

Restart all processes in the given group.

Parameters
processGroupthe group to restart

◆ shutdownPriorityOf()

ShutdownPriority lintel::ProcessService::shutdownPriorityOf ( ) const
inlineoverridevirtual

Returns the default shutdown priority.

Returns
ShutdownPriority::DEFAULT

Reimplemented from lintel::AbstractService< T >.

◆ startOf() [1/2]

std::optional< std::future< int > > lintel::ProcessService::startOf ( const Process &  process)

Start a process asynchronously.

Parameters
processthe process to start
Returns
a future for the exit code, or std::nullopt if start failed

◆ startOf() [2/2]

void lintel::ProcessService::startOf ( const ProcessGroup &  processGroup)

Start all processes in the given group.

Parameters
processGroupthe group to start

◆ stopOf() [1/2]

bool lintel::ProcessService::stopOf ( const Process &  process)

Stop a running process gracefully.

Parameters
processthe process to stop
Returns
true if the stop signal was sent

◆ stopOf() [2/2]

bool lintel::ProcessService::stopOf ( const ProcessGroup &  processGroup)

Stop all processes in the given group gracefully.

Parameters
processGroupthe group to stop
Returns
true if stop signals were sent

◆ terminateOf() [1/2]

void lintel::ProcessService::terminateOf ( const Process &  process)

Terminate a running process forcefully.

Parameters
processthe process to terminate

◆ terminateOf() [2/2]

void lintel::ProcessService::terminateOf ( const ProcessGroup &  processGroup)

Terminate all processes in the given group forcefully.

Parameters
processGroupthe group to terminate

The documentation for this class was generated from the following file: