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/consensus/consensus.service.h
Line
Count
Source (jump to first uncovered line)
1
// THIS FILE IS AUTOGENERATED FROM yb/consensus/consensus.proto
2
3
#pragma once
4
5
#include "yb/consensus/consensus.pb.h"
6
7
#include <string>
8
9
#include "yb/rpc/rpc_fwd.h"
10
#include "yb/rpc/rpc_header.pb.h"
11
#include "yb/rpc/service_if.h"
12
13
#include "yb/util/monotime.h"
14
15
namespace yb {
16
class MetricEntity;
17
} // namespace yb
18
19
namespace yb {
20
namespace consensus {
21
22
enum class ConsensusServiceRpcMethodIndexes {
23
  kUpdateConsensus,
24
  kMultiRaftUpdateConsensus,
25
  kRequestConsensusVote,
26
  kChangeConfig,
27
  kUnsafeChangeConfig,
28
  kGetNodeInstance,
29
  kRunLeaderElection,
30
  kLeaderElectionLost,
31
  kLeaderStepDown,
32
  kGetLastOpId,
33
  kGetConsensusState,
34
  kStartRemoteBootstrap,
35
}; // enum
36
37
class ConsensusServiceIf : public ::yb::rpc::ServiceIf {
38
 public:
39
  explicit ConsensusServiceIf(const scoped_refptr<MetricEntity>& entity);
40
  virtual ~ConsensusServiceIf();
41
  void Handle(::yb::rpc::InboundCallPtr call) override;
42
  void FillEndpoints(const ::yb::rpc::RpcServicePtr& service, ::yb::rpc::RpcEndpointMap* map) override;
43
  std::string service_name() const override;
44
  static std::string static_service_name();
45
46
  virtual void UpdateConsensus(
47
      const ::yb::consensus::ConsensusRequestPB* req,
48
      ::yb::consensus::ConsensusResponsePB* resp,
49
      ::yb::rpc::RpcContext context) = 0;
50
  virtual void MultiRaftUpdateConsensus(
51
      const ::yb::consensus::MultiRaftConsensusRequestPB* req,
52
      ::yb::consensus::MultiRaftConsensusResponsePB* resp,
53
      ::yb::rpc::RpcContext context) = 0;
54
  virtual void RequestConsensusVote(
55
      const ::yb::consensus::VoteRequestPB* req,
56
      ::yb::consensus::VoteResponsePB* resp,
57
      ::yb::rpc::RpcContext context) = 0;
58
  virtual void ChangeConfig(
59
      const ::yb::consensus::ChangeConfigRequestPB* req,
60
      ::yb::consensus::ChangeConfigResponsePB* resp,
61
      ::yb::rpc::RpcContext context) = 0;
62
  virtual void UnsafeChangeConfig(
63
      const ::yb::consensus::UnsafeChangeConfigRequestPB* req,
64
      ::yb::consensus::UnsafeChangeConfigResponsePB* resp,
65
      ::yb::rpc::RpcContext context) = 0;
66
  virtual void GetNodeInstance(
67
      const ::yb::consensus::GetNodeInstanceRequestPB* req,
68
      ::yb::consensus::GetNodeInstanceResponsePB* resp,
69
      ::yb::rpc::RpcContext context) = 0;
70
  virtual void RunLeaderElection(
71
      const ::yb::consensus::RunLeaderElectionRequestPB* req,
72
      ::yb::consensus::RunLeaderElectionResponsePB* resp,
73
      ::yb::rpc::RpcContext context) = 0;
74
  virtual void LeaderElectionLost(
75
      const ::yb::consensus::LeaderElectionLostRequestPB* req,
76
      ::yb::consensus::LeaderElectionLostResponsePB* resp,
77
      ::yb::rpc::RpcContext context) = 0;
78
  virtual void LeaderStepDown(
79
      const ::yb::consensus::LeaderStepDownRequestPB* req,
80
      ::yb::consensus::LeaderStepDownResponsePB* resp,
81
      ::yb::rpc::RpcContext context) = 0;
82
  virtual void GetLastOpId(
83
      const ::yb::consensus::GetLastOpIdRequestPB* req,
84
      ::yb::consensus::GetLastOpIdResponsePB* resp,
85
      ::yb::rpc::RpcContext context) = 0;
86
  virtual void GetConsensusState(
87
      const ::yb::consensus::GetConsensusStateRequestPB* req,
88
      ::yb::consensus::GetConsensusStateResponsePB* resp,
89
      ::yb::rpc::RpcContext context) = 0;
90
  virtual void StartRemoteBootstrap(
91
      const ::yb::consensus::StartRemoteBootstrapRequestPB* req,
92
      ::yb::consensus::StartRemoteBootstrapResponsePB* resp,
93
      ::yb::rpc::RpcContext context) = 0;
94
  
95
0
  ::yb::rpc::RpcMethodMetrics GetMetric(ConsensusServiceRpcMethodIndexes index) {
96
0
    return methods_[static_cast<size_t>(index)].metrics;
97
0
  }
98
99
 private:
100
  static const int kMethodCount = 12;
101
102
  // Pre-initialize metrics because calling METRIC_foo.Instantiate() is expensive.
103
  void InitMethods(const scoped_refptr<MetricEntity>& ent);
104
105
  ::yb::rpc::RpcMethodDesc methods_[kMethodCount];
106
};
107
108
} // namespace consensus
109
} // namespace yb
110