YugabyteDB (2.13.0.0-b42, bfc6a6643e7399ac8a0e81d06a3ee6d6571b33ab)

Coverage Report

Created: 2022-03-09 17:30

/Users/deen/code/yugabyte-db/src/yb/master/ysql_transaction_ddl.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_MASTER_YSQL_TRANSACTION_DDL_H
15
#define YB_MASTER_YSQL_TRANSACTION_DDL_H
16
17
#include <functional>
18
#include <memory>
19
20
#include "yb/client/client_fwd.h"
21
22
#include "yb/common/entity_ids.h"
23
24
#include "yb/master/master_fwd.h"
25
26
#include "yb/rpc/rpc.h"
27
28
#include "yb/util/status_fwd.h"
29
#include "yb/util/threadpool.h"
30
31
namespace yb {
32
namespace tserver {
33
class GetTransactionStatusResponsePB;
34
}
35
36
namespace master {
37
38
class YsqlTransactionDdl {
39
 public:
40
  YsqlTransactionDdl(
41
      const SysCatalogTable* sys_catalog, std::shared_future<client::YBClient*> client_future,
42
      ThreadPool* thread_pool)
43
      : sys_catalog_(sys_catalog), client_future_(std::move(client_future)),
44
5.42k
        thread_pool_(thread_pool) {}
45
46
  ~YsqlTransactionDdl();
47
48
0
  void set_thread_pool(yb::ThreadPool* thread_pool) {
49
0
    thread_pool_ = thread_pool;
50
0
  }
51
52
  void VerifyTransaction(const TransactionMetadata& transaction,
53
                         std::function<Status(bool /* is_success */)> complete_callback);
54
  Result<bool> PgEntryExists(TableId tableId, Result<uint32_t> entry_oid);
55
56
 protected:
57
  void TransactionReceived(const TransactionMetadata& transaction,
58
                           std::function<Status(bool)> complete_callback,
59
                           Status txn_status,
60
                           const tserver::GetTransactionStatusResponsePB& response);
61
62
  const SysCatalogTable* sys_catalog_;
63
  std::shared_future<client::YBClient*> client_future_;
64
  ThreadPool* thread_pool_;
65
  rpc::Rpcs rpcs_;
66
};
67
68
}  // namespace master
69
}  // namespace yb
70
71
#endif // YB_MASTER_YSQL_TRANSACTION_DDL_H