Zero  0.1.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ReaderThread Class Reference

Asynchronous reader thread for the recovery log. More...

#include <log_consumer.h>

Inheritance diagram for ReaderThread:
log_worker_thread_t worker_thread_t thread_wrapper_t

Public Member Functions

virtual void do_work ()
 
 ReaderThread (AsyncRingBuffer *readbuf, lsn_t startLSN)
 
virtual ~ReaderThread ()
 
size_t getBlockSize ()
 
- Public Member Functions inherited from log_worker_thread_t
 log_worker_thread_t (int interval_ms=-1)
 
virtual ~log_worker_thread_t ()
 
void wakeup_until_lsn (lsn_t lsn, bool wait=false, int rounds_to_wait=-1)
 
lsn_t getEndLSN ()
 
- Public Member Functions inherited from worker_thread_t
 worker_thread_t (int inverval_ms=-1)
 
virtual ~worker_thread_t ()
 
void wakeup (bool wait=false, int rounds_to_wait=-1)
 
void stop ()
 
void wait_for_round (long round=0)
 
long get_rounds_completed () const
 
bool is_busy () const
 
- Public Member Functions inherited from thread_wrapper_t
 thread_wrapper_t ()
 
virtual ~thread_wrapper_t ()
 
virtual void before_run ()
 
virtual void after_run ()
 
void spawn ()
 
void fork ()
 
void join ()
 

Protected Member Functions

rc_t openPartition ()
 
- Protected Member Functions inherited from worker_thread_t
bool should_exit () const
 
void notify_one ()
 
void notify_all ()
 
void quit ()
 

Protected Attributes

uint nextPartition
 
AsyncRingBufferbuf
 
int currentFd
 
off_t pos
 
lsn_t localEndLSN
 

Detailed Description

Asynchronous reader thread for the recovery log.

Similarly to the LogArchiver itself, this thread operates on activation cycles based on given "end LSN" values (see LogArchiver). This thread is controlled by LogArchiver::LogConsumer

The recovery log is read one block at a time, and each block is placed on an asynchronous ring buffer (see AsyncRingBuffer). Once the buffer is full, it automatically blocks waiting for a free slot.

Once the thread is shutdown, it exits its current/next wait and marks the buffer as "finished", which makes consumers stop waiting for new blocks once the buffer is empty.

Author
Caetano Sauer

Constructor & Destructor Documentation

§ ReaderThread()

ReaderThread::ReaderThread ( AsyncRingBuffer readbuf,
lsn_t  startLSN 
)

§ ~ReaderThread()

virtual ReaderThread::~ReaderThread ( )
inlinevirtual

Member Function Documentation

§ do_work()

void ReaderThread::do_work ( )
virtual

Actual working method to be implemented by derived classes.

Implements worker_thread_t.

§ getBlockSize()

size_t ReaderThread::getBlockSize ( )
inline

§ openPartition()

rc_t ReaderThread::openPartition ( )
protected

Member Data Documentation

§ buf

AsyncRingBuffer* ReaderThread::buf
protected

§ currentFd

int ReaderThread::currentFd
protected

§ localEndLSN

lsn_t ReaderThread::localEndLSN
protected

§ nextPartition

uint ReaderThread::nextPartition
protected

§ pos

off_t ReaderThread::pos
protected

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