YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/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
10.8k
inline BoundType LowerBound(bool exclusive) {
53
10.8k
  return exclusive ? 
BoundType::kExclusiveLower1.75k
:
BoundType::kInclusiveLower9.09k
;
54
10.8k
}
55
56
10.8k
inline BoundType UpperBound(bool exclusive) {
57
10.8k
  return exclusive ? 
BoundType::kExclusiveUpper1.80k
:
BoundType::kInclusiveUpper9.05k
;
58
10.8k
}
59
60
} // namespace docdb
61
} // namespace yb
62
63
#endif  // YB_DOCDB_DOCDB_TYPES_H_