STLdb

PrevUpHomeNext

Class log_reader

stldb::log_reader

Synopsis

// In header: </Users/bobw/workspace/stldb_lib/stldb/log_reader.h>


class log_reader {
public:
  // construct/copy/destruct
  log_reader(const char *);
  ~log_reader();

  // public member functions
  void close() ;
  transaction_id_t seek_transaction(transaction_id_t) ;
  transaction_id_t next_transaction() ;
  std::pair< log_header *, std::vector< char > * > get_transaction() ;

  // private member functions
  transaction_id_t read_next_txn() ;
};

Description

log_reader public construct/copy/destruct

  1. log_reader(const char * filename);
    Constructs a log_reader to read the contents of the indicated log file.
  2. ~log_reader();
    Closes any open log file.

log_reader public member functions

  1. void close() ;
    Closes any open log file.
  2. transaction_id_t seek_transaction(transaction_id_t lsn) ;

    Reads the log file until finding the first LSN which is equal to or greater than the LSN passed. Returns the transaction_id which if found. Returns no_transaction if the EOF is reached prior to finding an eligible transaction. throws if an error is encountered with the content of the log file.

  3. transaction_id_t next_transaction() ;

    Reads the next transaction from the log file. Returns the transaction_id which is found. Returns no_transaction if the EOF is reached. throws if an error is encountered with the content of the log file.

  4. std::pair< log_header *, std::vector< char > * > get_transaction() ;

    Returns the header and data buffer of the last transacton read from disk via a call to seekTransacton() or nextTransaction(). The returned pointers are only valid until the next call to either of those methods.

log_reader private member functions

  1. transaction_id_t read_next_txn() ;

    Read the next transaction from the file into _buffer. Confirm its checkpoints, and return the header of that transaction


PrevUpHomeNext