Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

LogState Class Reference
[LWLogging Service]

#include <LogState.h>

Collaboration diagram for LogState:

Collaboration graph
[legend]
List of all members.

Detailed Description

Maintains the state of the log.

The LogState is the point of reference and control for the Log. File functions, statistics, and state are kept here.

Todo:
Add shutdown hooks
Revision
1.9
Date
2004/11/01 00:17:18


Public Member Functions

 LogState (std::string log_name, unsigned long maxsize) throw (OrbInit::InitializationError)
 Create a LogState with a log name.

 LogState (std::string log_name, std::string log_dir, unsigned long maxsize) throw (OrbInit::InitializationError)
 Create a LogState with log name and an output directory.

CosLwLog::LogFullAction getFullAction ()
 Access the LogFullAction state.

CosLwLog::AvailabilityStatus getAvailStatus ()
 Access the Availability status.

CosLwLog::OperationalState getOpState ()
 Access the Operational state.

CosLwLog::AdministrativeState getAdminState ()
 Access the Administrative state.

void write_record (CosLwLog::LogRecord &recd)
unsigned long get_max_size ()
 Access the maximum size in bytes the log can be before becoming full.

void set_max_size (const unsigned long &max_size)
void setLogFullAction (const CosLwLog::LogFullAction &new_full_action)
void setAdminState (const CosLwLog::AdministrativeState &new_state)
void clearLog ()
void destroyLog ()
unsigned long get_current_size ()
 Access the current size of the Log in bytes.

unsigned long get_current_numb_records ()
 Access the current number of records in the file.

const IdxRecordId::IdxRecord find_log (const CosLwLog::LogTime &log_time)
const IdxRecordId::IdxRecord find_log (const CosLwLog::RecordId &recid)
const std::string get_log_file_name (const unsigned long &start_secs, const unsigned long &start_nanos)
const bool future_id (const CosLwLog::RecordId &recid) const
CosLwLog::RecordId future_id ()
CosLwLog::LogTime init_logtime ()
bool is_enabled ()


Constructor & Destructor Documentation

LogState::LogState std::string  log_name,
unsigned long  maxsize
throw (OrbInit::InitializationError)
 

Create a LogState with a log name.

LogState::LogState std::string  log_name,
std::string  log_dir,
unsigned long  maxsize
throw (OrbInit::InitializationError)
 

Create a LogState with log name and an output directory.


Member Function Documentation

void LogState::clearLog  ) 
 

Purge the active log

The active log will be copied to an archive. The Log continues to function per the current state. The active log begins recording Log Records immediately after the current records have been archived. The action is exactly as if the Log had reached its max size and Log Full Action is equal to WRAP. This operation is handy if the Log Full Action is HALT and the human administrator wants to restart the Log.

void LogState::destroyLog  ) 
 

Stop the current Log instance

Shuts down the Log, closes all files and removes all references from the NameService. All files continue to exist. If the Log is restarted, it will begin its Log Record state from the point where it shut down.

const IdxRecordId::IdxRecord LogState::find_log const CosLwLog::RecordId recid  ) 
 

Find a Log Archive containing the specified RecordId

Use a Record Id to find the Log Archive that contains the message associated with it

Parameters:
recid - The Record Id to find in a Log Archive
Returns:
IdxRecord describing the Log Archive containing the specified Record Id. If the specified Record Id does not exist in a Log Archive the IdxRecord is zerod.

const IdxRecordId::IdxRecord LogState::find_log const CosLwLog::LogTime log_time  ) 
 

Find a Log Archive containing the specified LogTime

Use a LogTime to find the Log Archive that contains records from that time

Parameters:
log_time - The time to find in a Log Archive
Returns:
IdxRecord describing the Log Archive containing the specified time. If the specified time does not exist in a Log Archive the IdxRecord is zerod.

CosLwLog::RecordId LogState::future_id  ) 
 

Obtain the future Record Id

Obtain the next future record id

Returns:
The future Record Id

const bool LogState::future_id const CosLwLog::RecordId recid  )  const
 

Test a record id to determine if it is in the future

Parameters:
recid - The record id to test
Returns:
TRUE if the record id is in the future

unsigned long LogState::get_current_numb_records  )  [inline]
 

Access the current number of records in the file.

unsigned long LogState::get_current_size  ) 
 

Access the current size of the Log in bytes.

const std::string LogState::get_log_file_name const unsigned long &  start_secs,
const unsigned long &  start_nanos
 

Manufacture a Log Archive name

A Log's starting time is used in its archive name including nano seconds. Given the starting seconds and nano seconds from an IdxRecord, construct the archives full file name.

Parameters:
start_secs - The Log's starting time in seconds
start_nanos - The Log's starting time refined in nano seconds
Returns:
The Log Archive's full name

unsigned long LogState::get_max_size  )  [inline]
 

Access the maximum size in bytes the log can be before becoming full.

CosLwLog::AdministrativeState LogState::getAdminState  )  [inline]
 

Access the Administrative state.

CosLwLog::AvailabilityStatus LogState::getAvailStatus  )  [inline]
 

Access the Availability status.

CosLwLog::LogFullAction LogState::getFullAction  )  [inline]
 

Access the LogFullAction state.

CosLwLog::OperationalState LogState::getOpState  )  [inline]
 

Access the Operational state.

void LogState::set_max_size const unsigned long &  max_size  ) 
 

Set a new max size

Set a new max size for the log. The current state will be immediately checked using the new max size

Parameters:
max_size The new maximum size

void LogState::setAdminState const CosLwLog::AdministrativeState new_state  ) 
 

Change this log's administrative state

The Adminstrative State determines if the Log can accept new log records. The new Administrative State takes immediate effect.

Parameters:
new_state - The new Administrative State locked or unlocked

void LogState::setLogFullAction const CosLwLog::LogFullAction new_full_action  ) 
 

Change the log full action

Adjust the log full action. The new action will take effect the next time the log reaches max_size

Parameters:
new_full_action - The new action WRAP or HALT

void LogState::write_record CosLwLog::LogRecord recd  ) 
 

Write a record to the log

Parameters:
recd - The LogRecord to write


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