YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/Users/deen/code/yugabyte-db/src/yb/rpc/rpc_call.h
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
#ifndef YB_RPC_RPC_CALL_H
15
#define YB_RPC_RPC_CALL_H
16
17
#include <stdint.h>
18
19
#include <type_traits>
20
21
#include "yb/gutil/ref_counted.h"
22
23
#include "yb/rpc/rpc_fwd.h"
24
#include "yb/rpc/outbound_data.h"
25
26
#include "yb/util/enums.h"
27
#include "yb/util/math_util.h"
28
29
namespace yb {
30
31
class Status;
32
33
namespace rpc {
34
35
YB_DEFINE_ENUM(TransferState, (PENDING)(FINISHED)(ABORTED));
36
37
class RpcCall : public OutboundData {
38
 public:
39
  // This functions is invoked in reactor thread of the appropriate connection, except during
40
  // reactor shutdown. In case of shutdown all such final calls are sequential. Therefore, this
41
  // function doesn't require synchronization.
42
  void Transferred(const Status& status, Connection* conn) override;
43
44
0
  virtual std::string LogPrefix() const {
45
0
    return "";
46
0
  }
47
48
 private:
49
  virtual void NotifyTransferred(const Status& status, Connection* conn) = 0;
50
51
  TransferState state_ = TransferState::PENDING;
52
};
53
54
}  // namespace rpc
55
}  // namespace yb
56
57
#endif // YB_RPC_RPC_CALL_H