]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. |
2 | // This source code is licensed under the BSD-style license found in the | |
3 | // LICENSE file in the root directory of this source tree. An additional grant | |
4 | // of patent rights can be found in the PATENTS file in the same directory. | |
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; | |
35 | virtual Status Put(const WriteOptions& options, | |
36 | ColumnFamilyHandle* column_family, const Slice& key, | |
37 | const Slice& value) override { | |
38 | return Status::NotSupported("Not supported in compacted db mode."); | |
39 | } | |
40 | using DBImpl::Merge; | |
41 | virtual Status Merge(const WriteOptions& options, | |
42 | ColumnFamilyHandle* column_family, const Slice& key, | |
43 | const Slice& value) override { | |
44 | return Status::NotSupported("Not supported in compacted db mode."); | |
45 | } | |
46 | using DBImpl::Delete; | |
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."); | |
51 | } | |
52 | virtual Status Write(const WriteOptions& options, | |
53 | WriteBatch* updates) override { | |
54 | return Status::NotSupported("Not supported in compacted db mode."); | |
55 | } | |
56 | using DBImpl::CompactRange; | |
57 | virtual Status CompactRange(const CompactRangeOptions& options, | |
58 | ColumnFamilyHandle* column_family, | |
59 | const Slice* begin, const Slice* end) override { | |
60 | return Status::NotSupported("Not supported in compacted db mode."); | |
61 | } | |
62 | ||
63 | virtual Status DisableFileDeletions() override { | |
64 | return Status::NotSupported("Not supported in compacted db mode."); | |
65 | } | |
66 | virtual Status EnableFileDeletions(bool force) override { | |
67 | return Status::NotSupported("Not supported in compacted db mode."); | |
68 | } | |
69 | virtual Status GetLiveFiles(std::vector<std::string>&, | |
70 | uint64_t* manifest_file_size, | |
71 | bool flush_memtable = true) override { | |
72 | return Status::NotSupported("Not supported in compacted db mode."); | |
73 | } | |
74 | using DBImpl::Flush; | |
75 | virtual Status Flush(const FlushOptions& options, | |
76 | ColumnFamilyHandle* column_family) override { | |
77 | return Status::NotSupported("Not supported in compacted db mode."); | |
78 | } | |
79 | using DB::IngestExternalFile; | |
80 | virtual Status IngestExternalFile( | |
81 | ColumnFamilyHandle* column_family, | |
82 | const std::vector<std::string>& external_files, | |
83 | const IngestExternalFileOptions& ingestion_options) override { | |
84 | return Status::NotSupported("Not supported in compacted db mode."); | |
85 | } | |
86 | ||
87 | private: | |
88 | friend class DB; | |
89 | inline size_t FindFile(const Slice& key); | |
90 | Status Init(const Options& options); | |
91 | ||
92 | ColumnFamilyData* cfd_; | |
93 | Version* version_; | |
94 | const Comparator* user_comparator_; | |
95 | LevelFilesBrief files_; | |
96 | ||
97 | // No copying allowed | |
98 | CompactedDBImpl(const CompactedDBImpl&); | |
99 | void operator=(const CompactedDBImpl&); | |
100 | }; | |
101 | } | |
102 | #endif // ROCKSDB_LITE |