作者: 韩晨旭 10225101440 李畅 10225102463
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

39 lines
814 B

#ifndef VTABLE_BUILDER_H
#define VTABLE_BUILDER_H
#include "leveldb/options.h"
#include "leveldb/slice.h"
#include "table/vtable_format.h"
#include "util/coding.h"
namespace leveldb {
class VTableBuilder {
public:
VTableBuilder(const Options& options, WritableFile* file);
// Add a record to the vTable
void Add(const VTableRecord& record, VTableHandle* handle);
// Builder status, return non-ok iff some error occurs
Status status() const { return status_; }
// Finish building the vTable
Status Finish();
// Abandon building the vTable
void Abandon();
private:
bool ok() const { return status().ok(); }
WritableFile* file_;
uint64_t file_size_{0};
Status status_;
RecordEncoder encoder_;
};
} // namespace leveldb
#endif //VTABLE_BUILDER_H