/Users/deen/code/yugabyte-db/src/yb/rocksdb/db/compacted_db_impl.h
Line | Count | Source (jump to first uncovered line) |
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 | | // The following only applies to changes made to this file as part of YugaByte development. |
7 | | // |
8 | | // Portions Copyright (c) YugaByte, Inc. |
9 | | // |
10 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
11 | | // in compliance with the License. You may obtain a copy of the License at |
12 | | // |
13 | | // http://www.apache.org/licenses/LICENSE-2.0 |
14 | | // |
15 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
16 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
17 | | // or implied. See the License for the specific language governing permissions and limitations |
18 | | // under the License. |
19 | | // |
20 | | #ifndef YB_ROCKSDB_DB_COMPACTED_DB_IMPL_H |
21 | | #define YB_ROCKSDB_DB_COMPACTED_DB_IMPL_H |
22 | | |
23 | | #pragma once |
24 | | #ifndef ROCKSDB_LITE |
25 | | #include <vector> |
26 | | #include <string> |
27 | | |
28 | | #include "yb/rocksdb/db/db_impl.h" |
29 | | |
30 | | namespace rocksdb { |
31 | | |
32 | | class CompactedDBImpl : public DBImpl { |
33 | | public: |
34 | | CompactedDBImpl(const DBOptions& options, const std::string& dbname); |
35 | | virtual ~CompactedDBImpl(); |
36 | | |
37 | | static Status Open(const Options& options, const std::string& dbname, |
38 | | DB** dbptr); |
39 | | |
40 | | // Implementations of the DB interface |
41 | | using DB::Get; |
42 | | virtual Status Get(const ReadOptions& options, |
43 | | ColumnFamilyHandle* column_family, const Slice& key, |
44 | | std::string* value) override; |
45 | | using DB::MultiGet; |
46 | | virtual std::vector<Status> MultiGet( |
47 | | const ReadOptions& options, |
48 | | const std::vector<ColumnFamilyHandle*>&, |
49 | | const std::vector<Slice>& keys, std::vector<std::string>* values) |
50 | | override; |
51 | | |
52 | | using DBImpl::Put; |
53 | | virtual Status Put(const WriteOptions& options, |
54 | | ColumnFamilyHandle* column_family, const Slice& key, |
55 | 2 | const Slice& value) override { |
56 | 2 | return STATUS(NotSupported, "Not supported in compacted db mode."); |
57 | 2 | } |
58 | | using DBImpl::Merge; |
59 | | virtual Status Merge(const WriteOptions& options, |
60 | | ColumnFamilyHandle* column_family, const Slice& key, |
61 | 0 | const Slice& value) override { |
62 | 0 | return STATUS(NotSupported, "Not supported in compacted db mode."); |
63 | 0 | } |
64 | | using DBImpl::Delete; |
65 | | virtual Status Delete(const WriteOptions& options, |
66 | | ColumnFamilyHandle* column_family, |
67 | 0 | const Slice& key) override { |
68 | 0 | return STATUS(NotSupported, "Not supported in compacted db mode."); |
69 | 0 | } |
70 | | virtual Status Write(const WriteOptions& options, |
71 | 0 | WriteBatch* updates) override { |
72 | 0 | return STATUS(NotSupported, "Not supported in compacted db mode."); |
73 | 0 | } |
74 | | using DBImpl::CompactRange; |
75 | | virtual Status CompactRange(const CompactRangeOptions& options, |
76 | | ColumnFamilyHandle* column_family, |
77 | 0 | const Slice* begin, const Slice* end) override { |
78 | 0 | return STATUS(NotSupported, "Not supported in compacted db mode."); |
79 | 0 | } |
80 | | |
81 | 0 | virtual Status DisableFileDeletions() override { |
82 | 0 | return STATUS(NotSupported, "Not supported in compacted db mode."); |
83 | 0 | } |
84 | 0 | virtual Status EnableFileDeletions(bool force) override { |
85 | 0 | return STATUS(NotSupported, "Not supported in compacted db mode."); |
86 | 0 | } |
87 | | virtual Status GetLiveFiles(std::vector<std::string>&, |
88 | | uint64_t* manifest_file_size, |
89 | 0 | bool flush_memtable = true) override { |
90 | 0 | return STATUS(NotSupported, "Not supported in compacted db mode."); |
91 | 0 | } |
92 | | using DBImpl::Flush; |
93 | | virtual Status Flush(const FlushOptions& options, |
94 | 0 | ColumnFamilyHandle* column_family) override { |
95 | 0 | return STATUS(NotSupported, "Not supported in compacted db mode."); |
96 | 0 | } |
97 | | using DBImpl::WaitForFlush; |
98 | 0 | virtual Status WaitForFlush(ColumnFamilyHandle* column_family) override { |
99 | 0 | return STATUS(NotSupported, "Not supported in compacted db mode."); |
100 | 0 | } |
101 | | |
102 | | private: |
103 | | friend class DB; |
104 | | inline size_t FindFile(const Slice& key); |
105 | | Status Init(const Options& options); |
106 | | |
107 | | ColumnFamilyData* cfd_; |
108 | | Version* version_; |
109 | | const Comparator* user_comparator_; |
110 | | LevelFilesBrief files_; |
111 | | |
112 | | // No copying allowed |
113 | | CompactedDBImpl(const CompactedDBImpl&); |
114 | | void operator=(const CompactedDBImpl&); |
115 | | }; |
116 | | } // namespace rocksdb |
117 | | #endif // ROCKSDB_LITE |
118 | | |
119 | | #endif // YB_ROCKSDB_DB_COMPACTED_DB_IMPL_H |