/Users/deen/code/yugabyte-db/src/yb/docdb/docdb_types.h
Line | Count | Source |
1 | | // Copyright (c) YugaByte, Inc. |
2 | | // |
3 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
4 | | // in compliance with the License. You may obtain a copy of the License at |
5 | | // |
6 | | // http://www.apache.org/licenses/LICENSE-2.0 |
7 | | // |
8 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
9 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
10 | | // or implied. See the License for the specific language governing permissions and limitations |
11 | | // under the License. |
12 | | // |
13 | | |
14 | | #ifndef YB_DOCDB_DOCDB_TYPES_H_ |
15 | | #define YB_DOCDB_DOCDB_TYPES_H_ |
16 | | |
17 | | #include "yb/util/enums.h" |
18 | | #include "yb/util/math_util.h" |
19 | | #include "yb/util/strongly_typed_bool.h" |
20 | | |
21 | | namespace yb { |
22 | | namespace docdb { |
23 | | |
24 | | // Used in various debug dump functions to specify whether to include binary representation in the |
25 | | // output. |
26 | | YB_STRONGLY_TYPED_BOOL(IncludeBinary); |
27 | | |
28 | | // To decide between regular (permanent) records RocksDB and provisional records (intents) RocksDB. |
29 | | YB_DEFINE_ENUM(StorageDbType, (kRegular)(kIntents)); |
30 | | |
31 | | // Type of keys written by DocDB into RocksDB. |
32 | | YB_DEFINE_ENUM( |
33 | | KeyType, |
34 | | (kEmpty) |
35 | | (kIntentKey) |
36 | | (kReverseTxnKey) |
37 | | (kPlainSubDocKey) |
38 | | (kTransactionMetadata) |
39 | | (kExternalIntents)); |
40 | | |
41 | | // ------------------------------------------------------------------------------------------------ |
42 | | // Bounds |
43 | | // ------------------------------------------------------------------------------------------------ |
44 | | |
45 | | YB_DEFINE_ENUM(BoundType, |
46 | | (kInvalid) |
47 | | (kExclusiveLower) |
48 | | (kInclusiveLower) |
49 | | (kExclusiveUpper) |
50 | | (kInclusiveUpper)); |
51 | | |
52 | 5.42k | inline BoundType LowerBound(bool exclusive) { |
53 | 4.53k | return exclusive ? BoundType::kExclusiveLower : BoundType::kInclusiveLower; |
54 | 5.42k | } |
55 | | |
56 | 5.42k | inline BoundType UpperBound(bool exclusive) { |
57 | 4.50k | return exclusive ? BoundType::kExclusiveUpper : BoundType::kInclusiveUpper; |
58 | 5.42k | } |
59 | | |
60 | | } // namespace docdb |
61 | | } // namespace yb |
62 | | |
63 | | #endif // YB_DOCDB_DOCDB_TYPES_H_ |