0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Static Public Member Functions | Static Private Member Functions | Static Private Attributes | List of all members
Hypertable::StatusPersister Class Reference

Persists program status information to disk. More...

#include <StatusPersister.h>

Collaboration diagram for Hypertable::StatusPersister:
Collaboration graph
[legend]

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...
 

Detailed Description

Persists program status information to disk.

Definition at line 43 of file StatusPersister.h.

Member Function Documentation

void StatusPersister::get ( Status status)
static

Gets persistent status.

If ms_fname is empty, calls initialize(). Then populates status with ms_status.

Parameters
statusProgram status to persist

Definition at line 135 of file StatusPersister.cc.

void StatusPersister::initialize ( )
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.

void StatusPersister::set ( const Status status,
std::vector< std::string >  additional_lines 
)
static

Sets persistent status.

If ms_fname is empty, calls initialize(), then creates a log entry and writes it to ms_fname.

Parameters
statusProgram status to persist
additional_linesAdditional 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.

Member Data Documentation

std::string StatusPersister::ms_fname
staticprivate

Name of persistent status file.

Definition at line 71 of file StatusPersister.h.

std::mutex StatusPersister::ms_mutex
staticprivate

Mutex for serializaing access to members

Definition at line 68 of file StatusPersister.h.

Status StatusPersister::ms_status
staticprivate

Current persistent status.

Definition at line 74 of file StatusPersister.h.


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