YugabyteDB (2.13.0.0-b42, bfc6a6643e7399ac8a0e81d06a3ee6d6571b33ab)

Coverage Report

Created: 2022-03-09 17:30

/Users/deen/code/yugabyte-db/src/yb/consensus/consensus_util.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_CONSENSUS_CONSENSUS_UTIL_H
15
#define YB_CONSENSUS_CONSENSUS_UTIL_H
16
17
#include <float.h>
18
19
#include <chrono>
20
#include <sstream>
21
#include <string>
22
#include <type_traits>
23
24
#include <boost/mpl/and.hpp>
25
26
#include "yb/util/enums.h"
27
#include "yb/util/format.h"
28
#include "yb/util/math_util.h"
29
#include "yb/util/tostring.h"
30
#include "yb/util/type_traits.h"
31
32
namespace yb {
33
namespace consensus {
34
35
// Specifies whether to send empty consensus requests from the leader to followers in case the queue
36
// is empty.
37
YB_DEFINE_ENUM(
38
    RequestTriggerMode,
39
40
    // Only send a request if it is not empty.
41
    (kNonEmptyOnly)
42
43
    // Send a request even if the queue is empty, and therefore (in most cases) the request is
44
    // empty. This is used during heartbeats from leader to peers.
45
    (kAlwaysSend));
46
47
1.82M
inline std::string MakeTabletLogPrefix(const std::string& tablet_id, const std::string& peer_id) {
48
1.82M
  return Format("T $0 P $1: ", tablet_id, peer_id);
49
1.82M
}
50
51
}  // namespace consensus
52
}  // namespace yb
53
54
#endif // YB_CONSENSUS_CONSENSUS_UTIL_H