]>
Commit | Line | Data |
---|---|---|
7c673cae | 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. |
11fdf7f2 TL |
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). | |
7c673cae FG |
5 | |
6 | #pragma once | |
7 | #ifndef ROCKSDB_LITE | |
8 | #include "db/db_impl.h" | |
9 | #include <vector> | |
10 | #include <string> | |
11 | ||
12 | namespace rocksdb { | |
13 | ||
14 | class CompactedDBImpl : public DBImpl { | |
15 | public: | |
16 | CompactedDBImpl(const DBOptions& options, const std::string& dbname); | |
17 | virtual ~CompactedDBImpl(); | |
18 | ||
19 | static Status Open(const Options& options, const std::string& dbname, | |
20 | DB** dbptr); | |
21 | ||
22 | // Implementations of the DB interface | |
23 | using DB::Get; | |
24 | virtual Status Get(const ReadOptions& options, | |
25 | ColumnFamilyHandle* column_family, const Slice& key, | |
26 | PinnableSlice* value) override; | |
27 | using DB::MultiGet; | |
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) | |
32 | override; | |
33 | ||
34 | using DBImpl::Put; | |
11fdf7f2 TL |
35 | virtual Status Put(const WriteOptions& /*options*/, |
36 | ColumnFamilyHandle* /*column_family*/, | |
37 | const Slice& /*key*/, const Slice& /*value*/) override { | |
7c673cae FG |
38 | return Status::NotSupported("Not supported in compacted db mode."); |
39 | } | |
40 | using DBImpl::Merge; | |
11fdf7f2 TL |
41 | virtual Status Merge(const WriteOptions& /*options*/, |
42 | ColumnFamilyHandle* /*column_family*/, | |
43 | const Slice& /*key*/, const Slice& /*value*/) override { | |
7c673cae FG |
44 | return Status::NotSupported("Not supported in compacted db mode."); |
45 | } | |
46 | using DBImpl::Delete; | |
11fdf7f2 TL |
47 | virtual Status Delete(const WriteOptions& /*options*/, |
48 | ColumnFamilyHandle* /*column_family*/, | |
49 | const Slice& /*key*/) override { | |
7c673cae FG |
50 | return Status::NotSupported("Not supported in compacted db mode."); |
51 | } | |
11fdf7f2 TL |
52 | virtual Status Write(const WriteOptions& /*options*/, |
53 | WriteBatch* /*updates*/) override { | |
7c673cae FG |
54 | return Status::NotSupported("Not supported in compacted db mode."); |
55 | } | |
56 | using DBImpl::CompactRange; | |
11fdf7f2 TL |
57 | virtual Status CompactRange(const CompactRangeOptions& /*options*/, |
58 | ColumnFamilyHandle* /*column_family*/, | |
59 | const Slice* /*begin*/, | |
60 | const Slice* /*end*/) override { | |
7c673cae FG |
61 | return Status::NotSupported("Not supported in compacted db mode."); |
62 | } | |
63 | ||
64 | virtual Status DisableFileDeletions() override { | |
65 | return Status::NotSupported("Not supported in compacted db mode."); | |
66 | } | |
11fdf7f2 | 67 | virtual Status EnableFileDeletions(bool /*force*/) override { |
7c673cae FG |
68 | return Status::NotSupported("Not supported in compacted db mode."); |
69 | } | |
494da23a TL |
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 */); | |
7c673cae FG |
75 | } |
76 | using DBImpl::Flush; | |
11fdf7f2 TL |
77 | virtual Status Flush(const FlushOptions& /*options*/, |
78 | ColumnFamilyHandle* /*column_family*/) override { | |
7c673cae FG |
79 | return Status::NotSupported("Not supported in compacted db mode."); |
80 | } | |
81 | using DB::IngestExternalFile; | |
82 | virtual Status IngestExternalFile( | |
11fdf7f2 TL |
83 | ColumnFamilyHandle* /*column_family*/, |
84 | const std::vector<std::string>& /*external_files*/, | |
85 | const IngestExternalFileOptions& /*ingestion_options*/) override { | |
7c673cae FG |
86 | return Status::NotSupported("Not supported in compacted db mode."); |
87 | } | |
88 | ||
89 | private: | |
90 | friend class DB; | |
91 | inline size_t FindFile(const Slice& key); | |
92 | Status Init(const Options& options); | |
93 | ||
94 | ColumnFamilyData* cfd_; | |
95 | Version* version_; | |
96 | const Comparator* user_comparator_; | |
97 | LevelFilesBrief files_; | |
98 | ||
99 | // No copying allowed | |
100 | CompactedDBImpl(const CompactedDBImpl&); | |
101 | void operator=(const CompactedDBImpl&); | |
102 | }; | |
103 | } | |
104 | #endif // ROCKSDB_LITE |