]> git.proxmox.com Git - ceph.git/blame - ceph/src/rocksdb/table/iter_heap.h
bump version to 12.1.1-pve1 while rebasing patches
[ceph.git] / ceph / src / rocksdb / table / iter_heap.h
CommitLineData
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
7#pragma once
8
9#include "rocksdb/comparator.h"
10#include "table/iterator_wrapper.h"
11
12namespace rocksdb {
13
14// When used with std::priority_queue, this comparison functor puts the
15// iterator with the max/largest key on top.
16class MaxIteratorComparator {
17 public:
18 MaxIteratorComparator(const Comparator* comparator) :
19 comparator_(comparator) {}
20
21 bool operator()(IteratorWrapper* a, IteratorWrapper* b) const {
22 return comparator_->Compare(a->key(), b->key()) < 0;
23 }
24 private:
25 const Comparator* comparator_;
26};
27
28// When used with std::priority_queue, this comparison functor puts the
29// iterator with the min/smallest key on top.
30class MinIteratorComparator {
31 public:
32 MinIteratorComparator(const Comparator* comparator) :
33 comparator_(comparator) {}
34
35 bool operator()(IteratorWrapper* a, IteratorWrapper* b) const {
36 return comparator_->Compare(a->key(), b->key()) > 0;
37 }
38 private:
39 const Comparator* comparator_;
40};
41
42} // namespace rocksdb