YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/Users/deen/code/yugabyte-db/src/yb/rocksdb/db/db_impl_readonly.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 ROCKSDB_DB_DB_IMPL_READONLY_H
21
#define ROCKSDB_DB_DB_IMPL_READONLY_H
22
23
#pragma once
24
25
#ifndef ROCKSDB_LITE
26
27
#include "yb/rocksdb/db/db_impl.h"
28
#include <vector>
29
#include <string>
30
31
namespace rocksdb {
32
33
class DBImplReadOnly : public DBImpl {
34
 public:
35
  DBImplReadOnly(const DBOptions& options, const std::string& dbname);
36
  virtual ~DBImplReadOnly();
37
38
  // Implementations of the DB interface
39
  using DB::Get;
40
  virtual Status Get(const ReadOptions& options,
41
                     ColumnFamilyHandle* column_family, const Slice& key,
42
                     std::string* value) override;
43
44
  // TODO: Implement ReadOnly MultiGet?
45
46
  using DBImpl::NewIterator;
47
  virtual Iterator* NewIterator(const ReadOptions&,
48
                                ColumnFamilyHandle* column_family) override;
49
50
  virtual Status NewIterators(
51
      const ReadOptions& options,
52
      const std::vector<ColumnFamilyHandle*>& column_families,
53
      std::vector<Iterator*>* iterators) override;
54
55
  using DBImpl::Put;
56
  virtual Status Put(const WriteOptions& options,
57
                     ColumnFamilyHandle* column_family, const Slice& key,
58
3
                     const Slice& value) override {
59
3
    return STATUS(NotSupported, "Not supported operation in read only mode.");
60
3
  }
61
  using DBImpl::Merge;
62
  virtual Status Merge(const WriteOptions& options,
63
                       ColumnFamilyHandle* column_family, const Slice& key,
64
0
                       const Slice& value) override {
65
0
    return STATUS(NotSupported, "Not supported operation in read only mode.");
66
0
  }
67
  using DBImpl::Delete;
68
  virtual Status Delete(const WriteOptions& options,
69
                        ColumnFamilyHandle* column_family,
70
0
                        const Slice& key) override {
71
0
    return STATUS(NotSupported, "Not supported operation in read only mode.");
72
0
  }
73
  using DBImpl::SingleDelete;
74
  virtual Status SingleDelete(const WriteOptions& options,
75
                              ColumnFamilyHandle* column_family,
76
0
                              const Slice& key) override {
77
0
    return STATUS(NotSupported, "Not supported operation in read only mode.");
78
0
  }
79
  virtual Status Write(const WriteOptions& options,
80
0
                       WriteBatch* updates) override {
81
0
    return STATUS(NotSupported, "Not supported operation in read only mode.");
82
0
  }
83
  using DBImpl::CompactRange;
84
  virtual Status CompactRange(const CompactRangeOptions& options,
85
                              ColumnFamilyHandle* column_family,
86
1
                              const Slice* begin, const Slice* end) override {
87
1
    return STATUS(NotSupported, "Not supported operation in read only mode.");
88
1
  }
89
90
  using DBImpl::CompactFiles;
91
  virtual Status CompactFiles(
92
      const CompactionOptions& compact_options,
93
      ColumnFamilyHandle* column_family,
94
      const std::vector<std::string>& input_file_names,
95
0
      const int output_level, const int output_path_id = -1) override {
96
0
    return STATUS(NotSupported, "Not supported operation in read only mode.");
97
0
  }
98
99
#ifndef ROCKSDB_LITE
100
0
  virtual Status DisableFileDeletions() override {
101
0
    return STATUS(NotSupported, "Not supported operation in read only mode.");
102
0
  }
103
104
0
  virtual Status EnableFileDeletions(bool force) override {
105
0
    return STATUS(NotSupported, "Not supported operation in read only mode.");
106
0
  }
107
  virtual Status GetLiveFiles(std::vector<std::string>&,
108
                              uint64_t* manifest_file_size,
109
0
                              bool flush_memtable = true) override {
110
0
    return STATUS(NotSupported, "Not supported operation in read only mode.");
111
0
  }
112
#endif  // ROCKSDB_LITE
113
114
  using DBImpl::Flush;
115
  virtual Status Flush(const FlushOptions& options,
116
0
                       ColumnFamilyHandle* column_family) override {
117
0
    return STATUS(NotSupported, "Not supported operation in read only mode.");
118
0
  }
119
120
  using DBImpl::SyncWAL;
121
1
  virtual Status SyncWAL() override {
122
1
    return STATUS(NotSupported, "Not supported operation in read only mode.");
123
1
  }
124
125
 private:
126
  friend class DB;
127
128
  // No copying allowed
129
  DBImplReadOnly(const DBImplReadOnly&);
130
  void operator=(const DBImplReadOnly&);
131
};
132
} // namespace rocksdb
133
134
#endif  // !ROCKSDB_LITE
135
136
#endif // ROCKSDB_DB_DB_IMPL_READONLY_H