Kyoto Tycoon

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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

kyototycoon::UpdateLogger::UpdateLogger | ( |  | ) | `[explicit]`

Default constructor.

kyototycoon::UpdateLogger::~UpdateLogger | ( |  | ) |

Destructor.

## Member Function Documentation

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

Open the logger.

Parameters:

  path | the path of the base directory.
  limsiz | the 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.
  asi | the interval of auto synchronization. If it is not more than 0, auto synchronization is not performed.

Returns:
  true on success, or false on failure.

bool kyototycoon::UpdateLogger::close | ( |  | ) |

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:

  mbuf | the pointer to the message region.
  msiz | the size of the message region.
  ts | the 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:

  mbuf | the pointer to the message region which is allocated by the new[] operator.
  msiz | the size of the message region.
  ts | the 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:

  mvec | a string vector of log messages.
  ts | the 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.

uint64_t kyototycoon::UpdateLogger::clock | ( |  | ) |

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:

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