github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/c-deps/libroach/comparator.h (about) 1 // Copyright 2018 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 #pragma once 12 13 #include <rocksdb/db.h> 14 15 namespace cockroach { 16 17 class DBComparator : public rocksdb::Comparator { 18 public: 19 DBComparator() {} 20 21 virtual const char* Name() const override { return "cockroach_comparator"; } 22 23 virtual int Compare(const rocksdb::Slice& a, const rocksdb::Slice& b) const override; 24 virtual bool Equal(const rocksdb::Slice& a, const rocksdb::Slice& b) const override; 25 virtual void FindShortestSeparator(std::string* start, 26 const rocksdb::Slice& limit) const override; 27 virtual void FindShortSuccessor(std::string* key) const override; 28 }; 29 30 const DBComparator kComparator; 31 32 } // namespace cockroach