2016-02-09 23:12:00 +00:00
|
|
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
2013-10-16 21:59:46 +00:00
|
|
|
// This source code is licensed under the BSD-style license found in the
|
|
|
|
// LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
// of patent rights can be found in the PATENTS file in the same directory.
|
2017-04-28 00:50:56 +00:00
|
|
|
// This source code is also licensed under the GPLv2 license found in the
|
|
|
|
// COPYING file in the root directory of this source tree.
|
2013-10-05 05:32:05 +00:00
|
|
|
#pragma once
|
2013-08-23 06:10:02 +00:00
|
|
|
|
2015-09-02 20:58:22 +00:00
|
|
|
#include <map>
|
|
|
|
#include <string>
|
2013-08-23 06:10:02 +00:00
|
|
|
|
2015-09-02 20:58:22 +00:00
|
|
|
#include "rocksdb/comparator.h"
|
2013-08-23 15:38:13 +00:00
|
|
|
#include "rocksdb/slice.h"
|
2015-09-02 20:58:22 +00:00
|
|
|
#include "util/coding.h"
|
|
|
|
#include "util/murmurhash.h"
|
2013-08-23 06:10:02 +00:00
|
|
|
|
2013-10-04 04:49:15 +00:00
|
|
|
namespace rocksdb {
|
2013-08-23 06:10:02 +00:00
|
|
|
namespace stl_wrappers {
|
|
|
|
|
2015-09-02 20:58:22 +00:00
|
|
|
struct LessOfComparator {
|
|
|
|
explicit LessOfComparator(const Comparator* c = BytewiseComparator())
|
|
|
|
: cmp(c) {}
|
|
|
|
|
|
|
|
bool operator()(const std::string& a, const std::string& b) const {
|
|
|
|
return cmp->Compare(Slice(a), Slice(b)) < 0;
|
|
|
|
}
|
2016-11-09 23:00:16 +00:00
|
|
|
bool operator()(const Slice& a, const Slice& b) const {
|
|
|
|
return cmp->Compare(a, b) < 0;
|
|
|
|
}
|
2015-09-02 20:58:22 +00:00
|
|
|
|
|
|
|
const Comparator* cmp;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::map<std::string, std::string, LessOfComparator> KVMap;
|
2013-08-23 06:10:02 +00:00
|
|
|
}
|
|
|
|
}
|