YugabyteDB (2.13.0.0-b42, bfc6a6643e7399ac8a0e81d06a3ee6d6571b33ab)

Coverage Report

Created: 2022-03-09 17:30

/Users/deen/code/yugabyte-db/src/yb/rocksdb/db/metadata.cc
Line
Count
Source (jump to first uncovered line)
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
#include "yb/rocksdb/metadata.h"
15
16
#include "yb/util/format.h"
17
18
namespace rocksdb {
19
20
600
std::string FileBoundaryValuesBase::ToString() const {
21
600
  return yb::Format("{ seqno: $0 user_frontier: $1 }", seqno, user_frontier);
22
600
}
23
24
142M
void UserFrontier::Update(const UserFrontier* rhs, UpdateUserValueType type, UserFrontierPtr* out) {
25
142M
  if (!rhs) {
26
142M
    return;
27
142M
  }
28
411k
  if (*out) {
29
3.61k
    (**out).Update(*rhs, type);
30
408k
  } else {
31
408k
    *out = rhs->Clone();
32
408k
  }
33
411k
}
34
35
0
bool UserFrontier::Dominates(const UserFrontier& rhs, UpdateUserValueType update_type) const {
36
  // Check that this value, if updated with the given rhs, stays the same, and hence "dominates" it.
37
0
  std::unique_ptr<UserFrontier> copy = Clone();
38
0
  copy->Update(rhs, update_type);
39
0
  return Equals(*copy);
40
0
}
41
42
void UpdateUserFrontier(UserFrontierPtr* value, const UserFrontierPtr& update,
43
6.13k
                        UpdateUserValueType type) {
44
6.13k
  if (*value) {
45
3.51k
    (**value).Update(*update, type);
46
2.62k
  } else {
47
2.62k
    *value = update;
48
2.62k
  }
49
6.13k
}
50
51
void UpdateUserFrontier(UserFrontierPtr* value, UserFrontierPtr&& update,
52
500k
                        UpdateUserValueType type) {
53
500k
  if (*value) {
54
7.61k
    (**value).Update(*update, type);
55
492k
  } else {
56
492k
    *value = std::move(update);
57
492k
  }
58
500k
}
59
60
14
std::string UserFrontiers::ToString() const {
61
14
  return ::yb::Format("{ smallest: $0 largest: $1 }", Smallest(), Largest());
62
14
}
63
64
95
std::string LiveFileMetaData::ToString() const {
65
95
  return YB_STRUCT_TO_STRING(
66
95
      total_size, base_size, uncompressed_size, name, db_path, imported,
67
95
      being_compacted, column_family_name, level, smallest, largest);
68
95
}
69
70
} // namespace rocksdb