Kyoto Tycoon
Classes | Public Member Functions | Static Public Member Functions
kyototycoon::UpdateLogger Class Reference

Update logger. More...

#include <ktulog.h>

List of all members.

Classes

class  AutoFlusher
 Automatic flusher of cacheed logs.
struct  FileStatus
 Status of each log file. More...
struct  Log
 Log message.
class  Reader
 Reader of update logs. More...

Public Member Functions

 UpdateLogger ()
 Default constructor.
 ~UpdateLogger ()
 Destructor.
bool open (const std::string &path, int64_t limsiz=-1, double asi=-1)
 Open the logger.
bool close ()
 Close the logger.
bool write (const char *mbuf, size_t msiz, uint64_t ts=0)
 Write a log message.
bool write_volatile (char *mbuf, size_t msiz, uint64_t ts=0)
 Write a log message with a volatile buffer.
bool write_bulk (const std::vector< std::string > &mvec, uint64_t ts=0)
 Write multiple log messages at once.
uint64_t clock ()
 Get the current clock data for time stamp.
void list_files (std::vector< FileStatus > *fstvec)
 Get status of each log files.

Static Public Member Functions

static uint64_t clock_pure ()
 Get the current pure clock data for time stamp.

Detailed Description

Update logger.


Constructor & Destructor Documentation

Default constructor.

Destructor.


Member Function Documentation

bool kyototycoon::UpdateLogger::open ( const std::string &  path,
int64_t  limsiz = -1,
double  asi = -1 
)

Open the logger.

Parameters:
paththe path of the base directory.
limsizthe limit size of each log file. If it is not more than 0, no limit is specified. If it is kyotocabinet::INT64MIN, the logger is opened as reader.
asithe interval of auto synchronization. If it is not more than 0, auto synchronization is not performed.
Returns:
true on success, or false on failure.

Close the logger.

Returns:
true on success, or false on failure.
bool kyototycoon::UpdateLogger::write ( const char *  mbuf,
size_t  msiz,
uint64_t  ts = 0 
)

Write a log message.

Parameters:
mbufthe pointer to the message region.
msizthe size of the message region.
tsthe time stamp of the message. If it is not more than 0, the current time stamp is specified.
Returns:
true on success, or false on failure.
bool kyototycoon::UpdateLogger::write_volatile ( char *  mbuf,
size_t  msiz,
uint64_t  ts = 0 
)

Write a log message with a volatile buffer.

Parameters:
mbufthe pointer to the message region which is allocated by the new[] operator.
msizthe size of the message region.
tsthe time stamp of the message. If it is not more than 0, the current time stamp is specified.
Returns:
true on success, or false on failure.
Note:
the message region is to be deleted inside this object implicitly.
bool kyototycoon::UpdateLogger::write_bulk ( const std::vector< std::string > &  mvec,
uint64_t  ts = 0 
)

Write multiple log messages at once.

Parameters:
mveca string vector of log messages.
tsthe time stamp of the message. If it is not more than 0, the current time stamp is specified.
Returns:
true on success, or false on failure.

Get the current clock data for time stamp.

Returns:
the current clock data for time stamp.
void kyototycoon::UpdateLogger::list_files ( std::vector< FileStatus > *  fstvec)

Get status of each log files.

Parameters:
fstveca vector to store status structures of each log files.
static uint64_t kyototycoon::UpdateLogger::clock_pure ( ) [static]

Get the current pure clock data for time stamp.

Returns:
the current pure clock data for time stamp.