YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/Users/deen/code/yugabyte-db/src/yb/common/table_properties_constants.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_COMMON_TABLE_PROPERTIES_CONSTANTS_H
15
#define YB_COMMON_TABLE_PROPERTIES_CONSTANTS_H
16
17
#include <cstring>
18
19
#include "yb/util/monotime.h"
20
#include "yb/util/string_case.h"
21
22
namespace yb {
23
24
namespace common {
25
26
static const MonoDelta kMaxTtl = MonoDelta::FromNanoseconds(std::numeric_limits<int64_t>::max());
27
28
static constexpr int64_t kInvalidUserTimestamp = std::numeric_limits<int64_t>::min();
29
30
// We use an upper bound of int32_t max (in seconds) for Cassandra. Note that this is higher than
31
// what vanilla Cassandra itself uses, since they store the expiry timestamp in seconds as
32
// int32_t and have overflow issues. See CASSANDRA-4771.
33
static const int64_t kCassandraMaxTtlSeconds = std::numeric_limits<int32_t>::max();
34
35
static const int64_t kCassandraMinTtlSeconds = 0;
36
37
// Verifies whether the TTL provided in milliseconds is valid.
38
296
inline static bool IsValidTTLSeconds(int64_t ttl_seconds) {
39
296
  return (ttl_seconds >= kCassandraMinTtlSeconds && 
ttl_seconds <= kCassandraMaxTtlSeconds294
);
40
296
}
pt_table_property.cc:yb::common::IsValidTTLSeconds(long long)
Line
Count
Source
38
208
inline static bool IsValidTTLSeconds(int64_t ttl_seconds) {
39
208
  return (ttl_seconds >= kCassandraMinTtlSeconds && ttl_seconds <= kCassandraMaxTtlSeconds);
40
208
}
eval_misc.cc:yb::common::IsValidTTLSeconds(long long)
Line
Count
Source
38
88
inline static bool IsValidTTLSeconds(int64_t ttl_seconds) {
39
88
  return (ttl_seconds >= kCassandraMinTtlSeconds && 
ttl_seconds <= kCassandraMaxTtlSeconds86
);
40
88
}
Unexecuted instantiation: value.cc:yb::common::IsValidTTLSeconds(long long)
41
42
static constexpr auto kSpeculativeRetryAlways = "always";
43
static constexpr auto kSpeculativeRetryMs = "ms";
44
static constexpr auto kSpeculativeRetryNone = "none";
45
static constexpr auto kSpeculativeRetryPercentile = "percentile";
46
47
static const auto kSpeculativeRetryMsLen = std::strlen(kSpeculativeRetryMs);
48
static const auto kSpeculativeRetryPercentileLen = std::strlen(kSpeculativeRetryPercentile);
49
50
static constexpr auto kCachingKeys = "keys";
51
static constexpr auto kCachingRowsPerPartition = "rows_per_partition";
52
static constexpr auto kCachingAll = "ALL";
53
static constexpr auto kCachingNone = "NONE";
54
55
75
inline static bool IsValidCachingKeysString(const std::string& str) {
56
75
  std::string upper_str;
57
75
  ToUpperCase(str, &upper_str);
58
75
  return (upper_str == kCachingAll || 
upper_str == kCachingNone47
);
59
75
}
pt_table_property.cc:yb::common::IsValidCachingKeysString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
55
75
inline static bool IsValidCachingKeysString(const std::string& str) {
56
75
  std::string upper_str;
57
75
  ToUpperCase(str, &upper_str);
58
75
  return (upper_str == kCachingAll || 
upper_str == kCachingNone47
);
59
75
}
Unexecuted instantiation: eval_misc.cc:yb::common::IsValidCachingKeysString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: value.cc:yb::common::IsValidCachingKeysString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
60
61
32
inline static bool IsValidCachingRowsPerPartitionString(const std::string& str) {
62
32
  return IsValidCachingKeysString(str);
63
32
}
pt_table_property.cc:yb::common::IsValidCachingRowsPerPartitionString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
61
32
inline static bool IsValidCachingRowsPerPartitionString(const std::string& str) {
62
32
  return IsValidCachingKeysString(str);
63
32
}
Unexecuted instantiation: eval_misc.cc:yb::common::IsValidCachingRowsPerPartitionString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: value.cc:yb::common::IsValidCachingRowsPerPartitionString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
64
65
6
inline static bool IsValidCachingRowsPerPartitionInt(const int64_t val) {
66
6
  return val <= std::numeric_limits<int32_t>::max();
67
6
}
pt_table_property.cc:yb::common::IsValidCachingRowsPerPartitionInt(long long)
Line
Count
Source
65
6
inline static bool IsValidCachingRowsPerPartitionInt(const int64_t val) {
66
6
  return val <= std::numeric_limits<int32_t>::max();
67
6
}
Unexecuted instantiation: eval_misc.cc:yb::common::IsValidCachingRowsPerPartitionInt(long long)
Unexecuted instantiation: value.cc:yb::common::IsValidCachingRowsPerPartitionInt(long long)
68
69
}  // namespace common
70
}  // namespace yb
71
72
#endif // YB_COMMON_TABLE_PROPERTIES_CONSTANTS_H