#pragma once
#include <string>
#include <vector>
#include "db/db_impl/db_impl.h"
namespace ROCKSDB_NAMESPACE {
class CompactedDBImpl : public DBImpl {
public:
CompactedDBImpl(const DBOptions& options, const std::string& dbname);
CompactedDBImpl(const CompactedDBImpl&) = delete;
void operator=(const CompactedDBImpl&) = delete;
~CompactedDBImpl() override;
static Status Open(const Options& options, const std::string& dbname,
std::unique_ptr<DB>* dbptr);
using DB::Get;
Status Get(const ReadOptions& options, ColumnFamilyHandle* column_family,
const Slice& key, PinnableSlice* value,
std::string* timestamp) override;
using DB::MultiGet;
void MultiGet(const ReadOptions& options, size_t num_keys,
ColumnFamilyHandle** column_families, const Slice* keys,
PinnableSlice* values, std::string* timestamps,
Status* statuses, const bool sorted_input) override;
using DBImpl::Put;
Status Put(const WriteOptions& ,
ColumnFamilyHandle* , const Slice& ,
const Slice& ) override {
return Status::NotSupported("Not supported in compacted db mode.");
}
using DBImpl::PutEntity;
Status PutEntity(const WriteOptions& ,
ColumnFamilyHandle* ,
const Slice& ,
const WideColumns& ) override {
return Status::NotSupported("Not supported in compacted db mode.");
}
using DBImpl::Merge;
Status Merge(const WriteOptions& ,
ColumnFamilyHandle* , const Slice& ,
const Slice& ) override {
return Status::NotSupported("Not supported in compacted db mode.");
}
using DBImpl::Delete;
Status Delete(const WriteOptions& ,
ColumnFamilyHandle* ,
const Slice& ) override {
return Status::NotSupported("Not supported in compacted db mode.");
}
Status Write(const WriteOptions& ,
WriteBatch* ) override {
return Status::NotSupported("Not supported in compacted db mode.");
}
using DBImpl::CompactRange;
Status CompactRange(const CompactRangeOptions& ,
ColumnFamilyHandle* ,
const Slice* , const Slice* ) override {
return Status::NotSupported("Not supported in compacted db mode.");
}
Status DisableFileDeletions() override {
return Status::NotSupported("Not supported in compacted db mode.");
}
Status EnableFileDeletions() override {
return Status::NotSupported("Not supported in compacted db mode.");
}
Status GetLiveFiles(std::vector<std::string>& ret,
uint64_t* manifest_file_size,
bool ) override {
return DBImpl::GetLiveFiles(ret, manifest_file_size,
false );
}
using DBImpl::Flush;
Status Flush(const FlushOptions& ,
ColumnFamilyHandle* ) override {
return Status::NotSupported("Not supported in compacted db mode.");
}
Status SyncWAL() override {
return Status::NotSupported("Not supported in compacted db mode.");
}
using DB::IngestExternalFile;
Status IngestExternalFile(
ColumnFamilyHandle* ,
const std::vector<std::string>& ,
const IngestExternalFileOptions& ) override {
return Status::NotSupported("Not supported in compacted db mode.");
}
using DB::CreateColumnFamilyWithImport;
Status CreateColumnFamilyWithImport(
const ColumnFamilyOptions& ,
const std::string& ,
const ImportColumnFamilyOptions& ,
const std::vector<const ExportImportFilesMetaData*>& ,
ColumnFamilyHandle** ) override {
return Status::NotSupported("Not supported in compacted db mode.");
}
using DB::ClipColumnFamily;
Status ClipColumnFamily(ColumnFamilyHandle* ,
const Slice& ,
const Slice& ) override {
return Status::NotSupported("Not supported in compacted db mode.");
}
protected:
Status FlushForGetLiveFiles() override {
return Status::OK();
}
private:
friend class DB;
inline size_t FindFile(const Slice& key);
Status Init(const Options& options);
ColumnFamilyData* cfd_;
Version* version_;
const Comparator* user_comparator_;
LevelFilesBrief files_;
};
}