dodo
0.0.1
A C++ library to create containerized Linux services
|
Go to the documentation of this file.
58 default:
return "unknown";
86 const std::string initcgroup =
"/proc/1/cgroup";
92 const std::string product_name =
"/sys/class/dmi/id/product_name";
97 res =
fileReadStrings( product_name, std::regex(
"^VMware Virtual Platform$") );
104 const std::string cpuinfo =
"/proc/cpuinfo";
106 auto res =
fileReadStrings( cpuinfo, std::regex(
"^flags.*:.*hypervisor") );
Start parameters for the Application.
std::string getAppName() const
Return the application name.
static Config * config_
The singleton pointer.
HostType detectHostType()
Detect the HostType of the host the Application is running on.
HostType hosttype_
The HostType, detected once in the Application constructor.
void log(LogLevel level, const std::string &message)
Log a log entry.
static void signal_handler(int signal)
Signal handler called by the OS.
static Logger * logger_
The singleton.
static Application * application_
Singleton Application object.
@ GenericVM
An indeterminate virtual machine.
@ Docker
Docker container.
void onSignal(int signal)
Called by signal_handler.
Logger * logger_
The Logger.
Includes all dodo headers.
@ BareMetal
Bare metal deployment.
static std::string getHostTypeAsString(HostType ht)
Convert a HostType to a human readable string.
Singleton interface to a (read-only) deployment configuration, combining data from the deployment con...
@ Info
The program signaled an informational message.
virtual ~Application()
Destructor.
Common and utility interfaces.
static Logger * initialize(const Config &config)
Initialize the Logger singleton.
Helper class to write strings in stream format, eg.
void initLibrary()
Initialize the dodo library.
bool has_stop_request_
True when the Application main pid got a signal to stop (SIGTERM).
std::vector< std::string > fileReadStrings(const std::string &filename)
Read the file as vector of strings.
void closeLibrary()
Close the dodo library.
Application(const StartParameters ¶m)
Construct an Application instance.
bool fileReadAccess(const std::string &path)
Return true when the file exists and the calling user has read access.
static Config * initialize(const std::string path)
Initialize the singleton.
#define log_Warning(what)
Macro to log Warning.
void installSignalHandlers()
Install the signal handlers.
std::string config
Configuration file.
HostType
The type of host the Application is running on.