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).
8 #include "db/db_impl.h"
14 class CompactedDBImpl
: public DBImpl
{
16 CompactedDBImpl(const DBOptions
& options
, const std::string
& dbname
);
17 virtual ~CompactedDBImpl();
19 static Status
Open(const Options
& options
, const std::string
& dbname
,
22 // Implementations of the DB interface
24 virtual Status
Get(const ReadOptions
& options
,
25 ColumnFamilyHandle
* column_family
, const Slice
& key
,
26 PinnableSlice
* value
) override
;
28 virtual std::vector
<Status
> MultiGet(
29 const ReadOptions
& options
,
30 const std::vector
<ColumnFamilyHandle
*>&,
31 const std::vector
<Slice
>& keys
, std::vector
<std::string
>* values
)
35 virtual Status
Put(const WriteOptions
& /*options*/,
36 ColumnFamilyHandle
* /*column_family*/,
37 const Slice
& /*key*/, const Slice
& /*value*/) override
{
38 return Status::NotSupported("Not supported in compacted db mode.");
41 virtual Status
Merge(const WriteOptions
& /*options*/,
42 ColumnFamilyHandle
* /*column_family*/,
43 const Slice
& /*key*/, const Slice
& /*value*/) override
{
44 return Status::NotSupported("Not supported in compacted db mode.");
47 virtual Status
Delete(const WriteOptions
& /*options*/,
48 ColumnFamilyHandle
* /*column_family*/,
49 const Slice
& /*key*/) override
{
50 return Status::NotSupported("Not supported in compacted db mode.");
52 virtual Status
Write(const WriteOptions
& /*options*/,
53 WriteBatch
* /*updates*/) override
{
54 return Status::NotSupported("Not supported in compacted db mode.");
56 using DBImpl::CompactRange
;
57 virtual Status
CompactRange(const CompactRangeOptions
& /*options*/,
58 ColumnFamilyHandle
* /*column_family*/,
59 const Slice
* /*begin*/,
60 const Slice
* /*end*/) override
{
61 return Status::NotSupported("Not supported in compacted db mode.");
64 virtual Status
DisableFileDeletions() override
{
65 return Status::NotSupported("Not supported in compacted db mode.");
67 virtual Status
EnableFileDeletions(bool /*force*/) override
{
68 return Status::NotSupported("Not supported in compacted db mode.");
70 virtual Status
GetLiveFiles(std::vector
<std::string
>& ret
,
71 uint64_t* manifest_file_size
,
72 bool /*flush_memtable*/) override
{
73 return DBImpl::GetLiveFiles(ret
, manifest_file_size
,
74 false /* flush_memtable */);
77 virtual Status
Flush(const FlushOptions
& /*options*/,
78 ColumnFamilyHandle
* /*column_family*/) override
{
79 return Status::NotSupported("Not supported in compacted db mode.");
81 using DB::IngestExternalFile
;
82 virtual Status
IngestExternalFile(
83 ColumnFamilyHandle
* /*column_family*/,
84 const std::vector
<std::string
>& /*external_files*/,
85 const IngestExternalFileOptions
& /*ingestion_options*/) override
{
86 return Status::NotSupported("Not supported in compacted db mode.");
91 inline size_t FindFile(const Slice
& key
);
92 Status
Init(const Options
& options
);
94 ColumnFamilyData
* cfd_
;
96 const Comparator
* user_comparator_
;
97 LevelFilesBrief files_
;
100 CompactedDBImpl(const CompactedDBImpl
&);
101 void operator=(const CompactedDBImpl
&);
104 #endif // ROCKSDB_LITE