]> git.proxmox.com Git - ceph.git/blame - ceph/src/rocksdb/utilities/compaction_filters/layered_compaction_filter_base.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / rocksdb / utilities / compaction_filters / layered_compaction_filter_base.h
CommitLineData
20effc67
TL
1// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
2// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file. See the AUTHORS file for names of contributors.
5
6#pragma once
7#include <memory>
8
9#include "rocksdb/compaction_filter.h"
10
11namespace ROCKSDB_NAMESPACE {
12
1e59de90 13// Abstract base class for building layered compaction filter on top of
20effc67
TL
14// user compaction filter.
15// See BlobIndexCompactionFilter or TtlCompactionFilter for a basic usage.
16class LayeredCompactionFilterBase : public CompactionFilter {
17 public:
18 LayeredCompactionFilterBase(
19 const CompactionFilter* _user_comp_filter,
20 std::unique_ptr<const CompactionFilter> _user_comp_filter_from_factory)
21 : user_comp_filter_(_user_comp_filter),
22 user_comp_filter_from_factory_(
23 std::move(_user_comp_filter_from_factory)) {
24 if (!user_comp_filter_) {
25 user_comp_filter_ = user_comp_filter_from_factory_.get();
26 }
27 }
28
29 // Return a pointer to user compaction filter
30 const CompactionFilter* user_comp_filter() const { return user_comp_filter_; }
31
1e59de90
TL
32 const Customizable* Inner() const override { return user_comp_filter_; }
33
34 protected:
20effc67 35 const CompactionFilter* user_comp_filter_;
1e59de90
TL
36
37 private:
20effc67
TL
38 std::unique_ptr<const CompactionFilter> user_comp_filter_from_factory_;
39};
40
41} // namespace ROCKSDB_NAMESPACE