2012-11-30 02:28:37 +01:00
|
|
|
// Copyright 2008-present Facebook. All Rights Reserved.
|
|
|
|
#ifndef STORAGE_LEVELDB_INCLUDE_TRANSACTION_LOG_ITERATOR_H_
|
|
|
|
#define STORAGE_LEVELDB_INCLUDE_TRANSACTION_LOG_ITERATOR_H_
|
|
|
|
|
|
|
|
#include "leveldb/status.h"
|
|
|
|
#include "leveldb/write_batch.h"
|
|
|
|
|
|
|
|
namespace leveldb {
|
|
|
|
|
|
|
|
|
|
|
|
// A TransactionLogIterator is used to iterate over the Transaction's in a db.
|
|
|
|
class TransactionLogIterator {
|
|
|
|
public:
|
|
|
|
TransactionLogIterator() {}
|
|
|
|
virtual ~TransactionLogIterator() {}
|
|
|
|
|
|
|
|
// An iterator is either positioned at a WriteBatch or not valid.
|
|
|
|
// This method returns true if the iterator is valid.
|
|
|
|
virtual bool Valid() = 0;
|
|
|
|
|
|
|
|
// Moves the iterator to the next WriteBatch.
|
|
|
|
// REQUIRES: Valid() to be true.
|
|
|
|
virtual void Next() = 0;
|
|
|
|
|
|
|
|
// Return's ok if the iterator is in a valid stated.
|
|
|
|
// Return the Error Status when the iterator is not Valid.
|
|
|
|
virtual Status status() = 0;
|
|
|
|
|
2012-12-11 21:24:55 +01:00
|
|
|
// If valid return's the current write_batch and the sequence number of the
|
|
|
|
// latest transaction contained in the batch.
|
|
|
|
virtual void GetBatch(WriteBatch* batch, SequenceNumber* seq) = 0;
|
2012-11-30 02:28:37 +01:00
|
|
|
};
|
|
|
|
} // namespace leveldb
|
|
|
|
|
|
|
|
#endif // STORAGE_LEVELDB_INCLUDE_TRANSACTION_LOG_ITERATOR_H_
|