#ifndef LEVELDB_BLOB_FILE_H_
|
|
#define LEVELDB_BLOB_FILE_H_
|
|
|
|
#include <string>
|
|
#include "leveldb/status.h"
|
|
#include "leveldb/slice.h"
|
|
#include "leveldb/env.h"
|
|
|
|
namespace leveldb {
|
|
namespace blob {
|
|
|
|
class BlobFile {
|
|
public:
|
|
explicit BlobFile(WritableFile* dest);
|
|
BlobFile(WritableFile* dest, uint64_t dest_length);
|
|
|
|
~BlobFile();
|
|
|
|
// 添加一条记录,记录写入的偏移量
|
|
Status AddRecord(const Slice& key, const Slice& value, uint64_t& offset);
|
|
|
|
private:
|
|
WritableFile* dest_; // 用于写入数据的目标文件
|
|
uint64_t head_; // 当前写入位置的偏移量
|
|
uint64_t bfid_; // 用于标识 BlobFile 的唯一 ID
|
|
// uint64_t head_; // 当前写入文件的偏移量
|
|
|
|
Status EmitDynamicRecord(const Slice& key, const Slice& value, uint64_t& offset);
|
|
};
|
|
|
|
} // namespace blob
|
|
} // namespace leveldb
|
|
|
|
#endif // LEVELDB_BLOB_FILE_H_
|