Line | Count | Source |
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). | |
5 | // | |
6 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. | |
7 | // Use of this source code is governed by a BSD-style license that can be | |
8 | // found in the LICENSE file. See the AUTHORS file for names of contributors. | |
9 | ||
10 | #pragma once | |
11 | ||
12 | #include "db/compaction/compaction_picker.h" | |
13 | #include "db/snapshot_checker.h" | |
14 | ||
15 | namespace ROCKSDB_NAMESPACE { | |
16 | class UniversalCompactionPicker : public CompactionPicker { | |
17 | public: | |
18 | UniversalCompactionPicker(const ImmutableOptions& ioptions, | |
19 | const InternalKeyComparator* icmp) | |
20 | 0 | : CompactionPicker(ioptions, icmp) {} |
21 | ||
22 | // If `require_max_output_level` is true, only pick compaction | |
23 | // with max output level or return nullptr if no such compaction exists. | |
24 | Compaction* PickCompaction( | |
25 | const std::string& cf_name, const MutableCFOptions& mutable_cf_options, | |
26 | const MutableDBOptions& mutable_db_options, | |
27 | const std::vector<SequenceNumber>& existing_snapshots, | |
28 | const SnapshotChecker* snapshot_checker, VersionStorageInfo* vstorage, | |
29 | LogBuffer* log_buffer, const std::string& full_history_ts_low, | |
30 | bool require_max_output_level = false) override; | |
31 | 0 | int MaxOutputLevel() const override { return NumberLevels() - 1; } |
32 | ||
33 | bool NeedsCompaction(const VersionStorageInfo* vstorage) const override; | |
34 | }; | |
35 | } // namespace ROCKSDB_NAMESPACE |