![]() |
stldb::log_reader
// In header: </Users/bobw/workspaces/STLdb/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(); };
log_reader
public
construct/copy/destructlog_reader(const char * filename);Constructs a
log_reader to read the contents of the indicated log file. ~log_reader();Closes any open log file.
log_reader public member functionsvoid close();Closes any open log file.
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 is found. If the EOF is reached prior to finding an eligible transaction, the last transaction read in is returned (i.e. a value which could be less than lsn)
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.
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.