/Users/deen/code/yugabyte-db/src/yb/util/yb_partition.h
Line | Count | Source |
1 | | //-------------------------------------------------------------------------------------------------- |
2 | | // Copyright (c) YugaByte, Inc. |
3 | | // |
4 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
5 | | // in compliance with the License. You may obtain a copy of the License at |
6 | | // |
7 | | // http://www.apache.org/licenses/LICENSE-2.0 |
8 | | // |
9 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
10 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
11 | | // or implied. See the License for the specific language governing permissions and limitations |
12 | | // under the License. |
13 | | // |
14 | | //-------------------------------------------------------------------------------------------------- |
15 | | |
16 | | #ifndef YB_UTIL_YB_PARTITION_H |
17 | | #define YB_UTIL_YB_PARTITION_H |
18 | | |
19 | | #include <string> |
20 | | #include "yb/util/status_fwd.h" |
21 | | #include "yb/gutil/endian.h" |
22 | | |
23 | | namespace yb { |
24 | | |
25 | | class YBPartition { |
26 | | public: |
27 | | static const uint16 kMaxHashCode = UINT16_MAX; |
28 | | static const uint16 kMinHashCode = 0; |
29 | | |
30 | | static uint16_t CqlToYBHashCode(int64_t cql_hash); |
31 | | |
32 | | static int64_t YBToCqlHashCode(uint16_t hash); |
33 | | |
34 | | static std::string CqlTokenSplit(size_t node_count, size_t index); |
35 | | |
36 | | static void AppendBytesToKey(const char *bytes, size_t len, std::string *encoded_key); |
37 | | |
38 | | template<typename signed_type, typename unsigned_type> |
39 | 7.43M | static void AppendIntToKey(signed_type val, std::string *encoded_key) { |
40 | 7.43M | unsigned_type uval = Load<unsigned_type, BigEndian>(&val); |
41 | 7.43M | encoded_key->append(reinterpret_cast<char *>(&uval), sizeof(uval)); |
42 | 7.43M | } _ZN2yb11YBPartition14AppendIntToKeyIijEEvT_PNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE Line | Count | Source | 39 | 5.81M | static void AppendIntToKey(signed_type val, std::string *encoded_key) { | 40 | 5.81M | unsigned_type uval = Load<unsigned_type, BigEndian>(&val); | 41 | 5.81M | encoded_key->append(reinterpret_cast<char *>(&uval), sizeof(uval)); | 42 | 5.81M | } |
_ZN2yb11YBPartition14AppendIntToKeyIbhEEvT_PNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE Line | Count | Source | 39 | 296 | static void AppendIntToKey(signed_type val, std::string *encoded_key) { | 40 | 296 | unsigned_type uval = Load<unsigned_type, BigEndian>(&val); | 41 | 296 | encoded_key->append(reinterpret_cast<char *>(&uval), sizeof(uval)); | 42 | 296 | } |
_ZN2yb11YBPartition14AppendIntToKeyIahEEvT_PNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE Line | Count | Source | 39 | 135k | static void AppendIntToKey(signed_type val, std::string *encoded_key) { | 40 | 135k | unsigned_type uval = Load<unsigned_type, BigEndian>(&val); | 41 | 135k | encoded_key->append(reinterpret_cast<char *>(&uval), sizeof(uval)); | 42 | 135k | } |
_ZN2yb11YBPartition14AppendIntToKeyIstEEvT_PNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE Line | Count | Source | 39 | 71.7k | static void AppendIntToKey(signed_type val, std::string *encoded_key) { | 40 | 71.7k | unsigned_type uval = Load<unsigned_type, BigEndian>(&val); | 41 | 71.7k | encoded_key->append(reinterpret_cast<char *>(&uval), sizeof(uval)); | 42 | 71.7k | } |
_ZN2yb11YBPartition14AppendIntToKeyIxyEEvT_PNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE Line | Count | Source | 39 | 1.40M | static void AppendIntToKey(signed_type val, std::string *encoded_key) { | 40 | 1.40M | unsigned_type uval = Load<unsigned_type, BigEndian>(&val); | 41 | 1.40M | encoded_key->append(reinterpret_cast<char *>(&uval), sizeof(uval)); | 42 | 1.40M | } |
_ZN2yb11YBPartition14AppendIntToKeyIjjEEvT_PNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE Line | Count | Source | 39 | 345 | static void AppendIntToKey(signed_type val, std::string *encoded_key) { | 40 | 345 | unsigned_type uval = Load<unsigned_type, BigEndian>(&val); | 41 | 345 | encoded_key->append(reinterpret_cast<char *>(&uval), sizeof(uval)); | 42 | 345 | } |
Unexecuted instantiation: _ZN2yb11YBPartition14AppendIntToKeyIyyEEvT_PNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE _ZN2yb11YBPartition14AppendIntToKeyIfjEEvT_PNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE Line | Count | Source | 39 | 398 | static void AppendIntToKey(signed_type val, std::string *encoded_key) { | 40 | 398 | unsigned_type uval = Load<unsigned_type, BigEndian>(&val); | 41 | 398 | encoded_key->append(reinterpret_cast<char *>(&uval), sizeof(uval)); | 42 | 398 | } |
_ZN2yb11YBPartition14AppendIntToKeyIdyEEvT_PNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE Line | Count | Source | 39 | 906 | static void AppendIntToKey(signed_type val, std::string *encoded_key) { | 40 | 906 | unsigned_type uval = Load<unsigned_type, BigEndian>(&val); | 41 | 906 | encoded_key->append(reinterpret_cast<char *>(&uval), sizeof(uval)); | 42 | 906 | } |
Unexecuted instantiation: _ZN2yb11YBPartition14AppendIntToKeyIhhEEvT_PNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE |
43 | | |
44 | | static uint16_t HashColumnCompoundValue(const std::string &compound); |
45 | | }; |
46 | | |
47 | | } // namespace yb |
48 | | |
49 | | #endif // YB_UTIL_YB_PARTITION_H |