Zero  0.1.0
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
LogConsumer Class Reference

Provides a record-at-a-time interface to the recovery log using asynchronous read operations. More...

#include <log_consumer.h>

Public Member Functions

 LogConsumer (lsn_t startLSN, size_t blockSize, bool ignore=true)
 
virtual ~LogConsumer ()
 
void shutdown ()
 
void open (lsn_t endLSN, bool readWholeBlocks=false)
 
bool next (logrec_t *&lr)
 
lsn_t getNextLSN ()
 

Static Public Member Functions

static void initLogScanner (LogScanner *logScanner)
 

Private Member Functions

bool nextBlock ()
 

Private Attributes

AsyncRingBufferreadbuf
 
ReaderThreadreader
 
LogScannerlogScanner
 
lsn_t nextLSN
 
lsn_t endLSN
 
char * currentBlock
 
size_t blockSize
 
size_t pos
 
bool readWholeBlocks
 

Detailed Description

Provides a record-at-a-time interface to the recovery log using asynchronous read operations.

This class manages an asynchronous reader thread (see ReaderThread) and the corresponding read buffer (see AsyncRingBuffer). It provides a record-at-a-time synchronous interface to the caller. It is used to read log records from the recovery log and push them into the archiver heap.

Access requires a preliminary call to the open() method, which activates the reader thread with the given end LSN. Otherwise, the next() method bay block indefinitely.

next() returns false when it reaches the end LSN, implying that the returned log record is invalid.

Author
Caetano Sauer

Constructor & Destructor Documentation

§ LogConsumer()

LogConsumer::LogConsumer ( lsn_t  startLSN,
size_t  blockSize,
bool  ignore = true 
)

§ ~LogConsumer()

LogConsumer::~LogConsumer ( )
virtual

Member Function Documentation

§ getNextLSN()

lsn_t LogConsumer::getNextLSN ( )
inline

§ initLogScanner()

void LogConsumer::initLogScanner ( LogScanner logScanner)
static

§ next()

bool LogConsumer::next ( logrec_t *&  lr)

§ nextBlock()

bool LogConsumer::nextBlock ( )
private

§ open()

void LogConsumer::open ( lsn_t  endLSN,
bool  readWholeBlocks = false 
)

§ shutdown()

void LogConsumer::shutdown ( )

Member Data Documentation

§ blockSize

size_t LogConsumer::blockSize
private

§ currentBlock

char* LogConsumer::currentBlock
private

§ endLSN

lsn_t LogConsumer::endLSN
private

§ logScanner

LogScanner* LogConsumer::logScanner
private

§ nextLSN

lsn_t LogConsumer::nextLSN
private

§ pos

size_t LogConsumer::pos
private

§ readbuf

AsyncRingBuffer* LogConsumer::readbuf
private

§ reader

ReaderThread* LogConsumer::reader
private

§ readWholeBlocks

bool LogConsumer::readWholeBlocks
private

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