Persists program status information to disk. More...
#include <StatusPersister.h>
Static Public Member Functions | |
static void | set (const Status &status, std::vector< std::string > additional_lines) |
Sets persistent status. More... | |
static void | get (Status &status) |
Gets persistent status. More... | |
Static Private Member Functions | |
static void | initialize () |
Initializes variables. More... | |
Static Private Attributes | |
static std::mutex | ms_mutex |
Mutex for serializaing access to members More... | |
static std::string | ms_fname |
Name of persistent status file. More... | |
static Status | ms_status |
Current persistent status. More... | |
Persists program status information to disk.
Definition at line 43 of file StatusPersister.h.
|
static |
Gets persistent status.
If ms_fname is empty, calls initialize(). Then populates status
with ms_status.
status | Program status to persist |
Definition at line 135 of file StatusPersister.cc.
|
staticprivate |
Initializes variables.
This function sets ms_fname to $HT_HOME/run/STATUS.<program_name>
and if the file exists, parses it and initializes ms_status with the last entry.
Definition at line 142 of file StatusPersister.cc.
|
static |
Sets persistent status.
If ms_fname is empty, calls initialize(), then creates a log entry and writes it to ms_fname.
status | Program status to persist |
additional_lines | Additional log entry lines |
Prior to writing the entry, if ms_fname does not exist, a comment header is written to the file. The format of the status entry is as follows:
WARNING - Corruption encountered in commit log file /hypertable/servers/rs1/log/user/0 Time 2025-02-03 16:36:00 HYPERTABLE block compressor bad block header Header checksum mismatch: 19262 (computed) != 23614 (stored) File archived to /hypertable/backup/hypertable/servers/rs1/log/user/0
The first line is the status information from status
, the second line contain the current time, and the subsequent lines are additional_lines
.
Definition at line 82 of file StatusPersister.cc.
|
staticprivate |
Name of persistent status file.
Definition at line 71 of file StatusPersister.h.
|
staticprivate |
Mutex for serializaing access to members
Definition at line 68 of file StatusPersister.h.
|
staticprivate |
Current persistent status.
Definition at line 74 of file StatusPersister.h.