YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/Users/deen/code/yugabyte-db/build/debugcov-clang-dynamic-arm64-ninja/src/yb/util/opid.messages.cc
Line
Count
Source (jump to first uncovered line)
1
// THIS FILE IS AUTOGENERATED FROM yb/util/opid.proto
2
3
#include "yb/util/opid.messages.h"
4
5
#include "yb/gutil/strings/numbers.h"
6
7
namespace yb {
8
9
0
LWOpIdPB::LWOpIdPB(::yb::Arena* arena) {
10
0
}
11
12
LWOpIdPB::LWOpIdPB(::yb::Arena* arena, const LWOpIdPB& rhs)
13
    : has_fields_(rhs.has_fields_),
14
      term_(rhs.term_),
15
0
      index_(rhs.index_) {
16
0
}
17
18
0
void LWOpIdPB::AppendToDebugString(std::string* out) const {
19
0
  bool first = true;if (has_term()) {
20
0
    ::yb::rpc::AppendFieldTitle("term", ": ", &first, out);
21
0
    *out += std::to_string(term());
22
0
  }
23
0
  if (has_index()) {
24
0
    ::yb::rpc::AppendFieldTitle("index", ": ", &first, out);
25
0
    *out += std::to_string(index());
26
0
  }
27
0
}
28
29
0
void LWOpIdPB::Clear() {
30
0
  clear_term();
31
0
  clear_index();
32
0
}
33
34
0
void LWOpIdPB::CopyFrom(const LWOpIdPB& rhs) {
35
0
  if (rhs.has_term()) {
36
0
    term_ = rhs.term_;
37
0
  } else {
38
0
    clear_term();
39
0
  }
40
0
  if (rhs.has_index()) {
41
0
    index_ = rhs.index_;
42
0
  } else {
43
0
    clear_index();
44
0
  }
45
0
  has_fields_ = rhs.has_fields_;
46
0
}
47
48
0
void LWOpIdPB::CopyFrom(const OpIdPB& rhs) {
49
0
  if (rhs.has_term()) {
50
0
    term_ = rhs.term();
51
0
    has_fields_.Set(OpIdPBFields::kTerm);
52
0
  } else {
53
0
    clear_term();
54
0
  }
55
0
  if (rhs.has_index()) {
56
0
    index_ = rhs.index();
57
0
    has_fields_.Set(OpIdPBFields::kIndex);
58
0
  } else {
59
0
    clear_index();
60
0
  }
61
0
}
62
63
0
Status LWOpIdPB::ParseFromCodedStream(google::protobuf::io::CodedInputStream* input) {
64
0
  for (;;) {
65
0
    auto p = input->ReadTagWithCutoffNoLastTag(31);
66
0
    if (!p.second && !p.first) {
67
0
      return Status::OK();
68
0
    }
69
0
    switch(::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(p.first)) {
70
0
      case 1: { // term
71
0
        if (!::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_INT64, int64_t>::Read(input, mutable_term())) {
72
0
          return ::yb::rpc::ParseFailed("term");
73
0
        }
74
0
        break;
75
0
      }
76
0
      case 2: { // index
77
0
        if (!::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_INT64, int64_t>::Read(input, mutable_index())) {
78
0
          return ::yb::rpc::ParseFailed("index");
79
0
        }
80
0
        break;
81
0
      }
82
0
    }
83
0
  }
84
0
}
85
86
0
uint8_t* LWOpIdPB::SerializeToArray(uint8_t* out) const {
87
0
  if (has_term()) {
88
0
    out = ::yb::rpc::SingleWrite<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_INT64, int64_t>, 8>(term_, out);
89
0
  }
90
0
  if (has_index()) {
91
0
    out = ::yb::rpc::SingleWrite<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_INT64, int64_t>, 16>(index_, out);
92
0
  }
93
0
  return out;
94
0
}
95
96
0
size_t LWOpIdPB::SerializedSize() const {
97
0
  size_t result = 0;
98
0
  if (has_term()) {
99
0
    result += ::yb::rpc::SingleSize<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_INT64, int64_t>, 1>(term_);
100
0
  }
101
0
  if (has_index()) {
102
0
    result += ::yb::rpc::SingleSize<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_INT64, int64_t>, 1>(index_);
103
0
  }
104
0
  cached_size_ = result;
105
0
  return result;
106
0
}
107
108
0
void LWOpIdPB::ToGoogleProtobuf(OpIdPB* out) const {
109
0
  if (has_term()) {
110
0
    out->set_term(term_);
111
0
  } else {
112
0
    out->clear_term();
113
0
  }
114
0
  if (has_index()) {
115
0
    out->set_index(index_);
116
0
  } else {
117
0
    out->clear_index();
118
0
  }
119
0
}
120
121
} // namespace yb