mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-27 02:44:18 +00:00
8055008909
Summary: How it works: * GetUpdatesSince takes a SequenceNumber. * A LogFile with the first SequenceNumber nearest and lesser than the requested Sequence Number is found. * Seek in the logFile till the requested SeqNumber is found. * Return an iterator which contains logic to return record's one by one. Test Plan: * Test case included to check the good code path. * Will update with more test-cases. * Feedback required on test-cases. Reviewers: dhruba, emayanke Reviewed By: dhruba CC: leveldb Differential Revision: https://reviews.facebook.net/D7119
49 lines
995 B
C++
49 lines
995 B
C++
// Copyright 2008-present Facebook. All Rights Reserved.
|
|
|
|
#ifndef STORAGE_LEVELDB_DB_LOG_FILE_H_
|
|
#define STORAGE_LEVELDB_DB_LOG_FILE_H_
|
|
|
|
namespace leveldb {
|
|
|
|
enum WalFileType {
|
|
kArchivedLogFile = 0,
|
|
kAliveLogFile = 1
|
|
} ;
|
|
|
|
class LogFile {
|
|
|
|
public:
|
|
uint64_t logNumber;
|
|
WalFileType type;
|
|
|
|
LogFile(uint64_t logNum,WalFileType logType) :
|
|
logNumber(logNum),
|
|
type(logType) {}
|
|
|
|
LogFile(const LogFile& that) {
|
|
logNumber = that.logNumber;
|
|
type = that.type;
|
|
}
|
|
|
|
bool operator < (const LogFile& that) const {
|
|
return logNumber < that.logNumber;
|
|
}
|
|
|
|
std::string ToString() const {
|
|
char response[100];
|
|
const char* typeOfLog;
|
|
if (type == kAliveLogFile) {
|
|
typeOfLog = "Alive Log";
|
|
} else {
|
|
typeOfLog = "Archived Log";
|
|
}
|
|
sprintf(response,
|
|
"LogNumber : %ld LogType : %s",
|
|
logNumber,
|
|
typeOfLog);
|
|
return std::string(response);
|
|
}
|
|
};
|
|
} // namespace leveldb
|
|
#endif // STORAGE_LEVELDB_DB_LOG_FILE_H_
|