YugabyteDB (2.13.0.0-b42, bfc6a6643e7399ac8a0e81d06a3ee6d6571b33ab)

Coverage Report

Created: 2022-03-09 17:30

/Users/deen/code/yugabyte-db/src/yb/tserver/read_query.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_TSERVER_READ_QUERY_H
15
#define YB_TSERVER_READ_QUERY_H
16
17
#include "yb/common/common_net.pb.h"
18
#include "yb/common/read_hybrid_time.h"
19
#include "yb/common/transaction.h"
20
21
#include "yb/rpc/rpc_context.h"
22
#include "yb/rpc/thread_pool.h"
23
24
#include "yb/server/clock.h"
25
26
#include "yb/tablet/abstract_tablet.h"
27
28
#include "yb/tserver/tserver_fwd.h"
29
#include "yb/tserver/tserver.fwd.h"
30
31
namespace yb {
32
namespace tserver {
33
34
// Actually it would be better to rely on TabletServerIf::tablet_peer_lookup, but master
35
// has pretty different logic in obtaining read tablet.
36
// Moreover in master we have several places to get tablet, but all of them has different logic.
37
// So it is good example of bad design that was not refactored in a proper time.
38
// And now it is non trivial task to merge all such places into a single one.
39
class ReadTabletProvider {
40
 public:
41
  virtual Result<std::shared_ptr<tablet::AbstractTablet>> GetTabletForRead(
42
    const TabletId& tablet_id, tablet::TabletPeerPtr tablet_peer,
43
    YBConsistencyLevel consistency_level, AllowSplitTablet allow_split_tablet) = 0;
44
45
160
  virtual ~ReadTabletProvider() = default;
46
};
47
48
void PerformRead(
49
    TabletServerIf* server, ReadTabletProvider* read_tablet_provider,
50
    const ReadRequestPB* req, ReadResponsePB* resp, rpc::RpcContext context);
51
52
}  // namespace tserver
53
}  // namespace yb
54
55
#endif  // YB_TSERVER_READ_QUERY_H