1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
10 #include "db/db_impl/db_impl.h"
12 namespace ROCKSDB_NAMESPACE
{
14 class CompactedDBImpl
: public DBImpl
{
16 CompactedDBImpl(const DBOptions
& options
, const std::string
& dbname
);
18 CompactedDBImpl(const CompactedDBImpl
&) = delete;
19 void operator=(const CompactedDBImpl
&) = delete;
21 virtual ~CompactedDBImpl();
23 static Status
Open(const Options
& options
, const std::string
& dbname
,
26 // Implementations of the DB interface
28 virtual Status
Get(const ReadOptions
& options
,
29 ColumnFamilyHandle
* column_family
, const Slice
& key
,
30 PinnableSlice
* value
) override
;
32 virtual std::vector
<Status
> MultiGet(
33 const ReadOptions
& options
,
34 const std::vector
<ColumnFamilyHandle
*>&,
35 const std::vector
<Slice
>& keys
, std::vector
<std::string
>* values
)
39 virtual Status
Put(const WriteOptions
& /*options*/,
40 ColumnFamilyHandle
* /*column_family*/,
41 const Slice
& /*key*/, const Slice
& /*value*/) override
{
42 return Status::NotSupported("Not supported in compacted db mode.");
45 virtual Status
Merge(const WriteOptions
& /*options*/,
46 ColumnFamilyHandle
* /*column_family*/,
47 const Slice
& /*key*/, const Slice
& /*value*/) override
{
48 return Status::NotSupported("Not supported in compacted db mode.");
51 virtual Status
Delete(const WriteOptions
& /*options*/,
52 ColumnFamilyHandle
* /*column_family*/,
53 const Slice
& /*key*/) override
{
54 return Status::NotSupported("Not supported in compacted db mode.");
56 virtual Status
Write(const WriteOptions
& /*options*/,
57 WriteBatch
* /*updates*/) override
{
58 return Status::NotSupported("Not supported in compacted db mode.");
60 using DBImpl::CompactRange
;
61 virtual Status
CompactRange(const CompactRangeOptions
& /*options*/,
62 ColumnFamilyHandle
* /*column_family*/,
63 const Slice
* /*begin*/,
64 const Slice
* /*end*/) override
{
65 return Status::NotSupported("Not supported in compacted db mode.");
68 virtual Status
DisableFileDeletions() override
{
69 return Status::NotSupported("Not supported in compacted db mode.");
71 virtual Status
EnableFileDeletions(bool /*force*/) override
{
72 return Status::NotSupported("Not supported in compacted db mode.");
74 virtual Status
GetLiveFiles(std::vector
<std::string
>& ret
,
75 uint64_t* manifest_file_size
,
76 bool /*flush_memtable*/) override
{
77 return DBImpl::GetLiveFiles(ret
, manifest_file_size
,
78 false /* flush_memtable */);
81 virtual Status
Flush(const FlushOptions
& /*options*/,
82 ColumnFamilyHandle
* /*column_family*/) override
{
83 return Status::NotSupported("Not supported in compacted db mode.");
85 using DB::IngestExternalFile
;
86 virtual Status
IngestExternalFile(
87 ColumnFamilyHandle
* /*column_family*/,
88 const std::vector
<std::string
>& /*external_files*/,
89 const IngestExternalFileOptions
& /*ingestion_options*/) override
{
90 return Status::NotSupported("Not supported in compacted db mode.");
92 using DB::CreateColumnFamilyWithImport
;
93 virtual Status
CreateColumnFamilyWithImport(
94 const ColumnFamilyOptions
& /*options*/,
95 const std::string
& /*column_family_name*/,
96 const ImportColumnFamilyOptions
& /*import_options*/,
97 const ExportImportFilesMetaData
& /*metadata*/,
98 ColumnFamilyHandle
** /*handle*/) override
{
99 return Status::NotSupported("Not supported in compacted db mode.");
104 inline size_t FindFile(const Slice
& key
);
105 Status
Init(const Options
& options
);
107 ColumnFamilyData
* cfd_
;
109 const Comparator
* user_comparator_
;
110 LevelFilesBrief files_
;
112 } // namespace ROCKSDB_NAMESPACE
113 #endif // ROCKSDB_LITE