YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/Users/deen/code/yugabyte-db/src/yb/tablet/transaction_participant_context.h
Line
Count
Source
1
//
2
// Copyright (c) YugaByte, Inc.
3
//
4
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5
// in compliance with the License.  You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software distributed under the License
10
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11
// or implied.  See the License for the specific language governing permissions and limitations
12
// under the License.
13
//
14
//
15
16
#ifndef YB_TABLET_TRANSACTION_PARTICIPANT_CONTEXT_H
17
#define YB_TABLET_TRANSACTION_PARTICIPANT_CONTEXT_H
18
19
#include <future>
20
21
#include "yb/client/client_fwd.h"
22
#include "yb/rpc/rpc_fwd.h"
23
#include "yb/server/server_fwd.h"
24
#include "yb/tablet/tablet_fwd.h"
25
#include "yb/util/monotime.h"
26
27
namespace yb {
28
namespace tablet {
29
30
class TransactionParticipantContext {
31
 public:
32
  virtual const std::string& permanent_uuid() const = 0;
33
  virtual const std::string& tablet_id() const = 0;
34
  virtual const std::shared_future<client::YBClient*>& client_future() const = 0;
35
  virtual const server::ClockPtr& clock_ptr() const = 0;
36
  virtual rpc::Scheduler& scheduler() const = 0;
37
38
  // Fills RemoveIntentsData with information about replicated state.
39
  virtual CHECKED_STATUS GetLastReplicatedData(RemoveIntentsData* data) = 0;
40
  virtual void GetLastCDCedData(RemoveIntentsData* data) = 0;
41
  // Enqueue task to participant context strand.
42
  virtual void StrandEnqueue(rpc::StrandTask* task) = 0;
43
  virtual void UpdateClock(HybridTime hybrid_time) = 0;
44
  virtual bool IsLeader() = 0;
45
  virtual void SubmitUpdateTransaction(
46
      std::unique_ptr<UpdateTxnOperation> state, int64_t term) = 0;
47
48
  // Returns hybrid time that lower than any future transaction apply record.
49
  virtual HybridTime SafeTimeForTransactionParticipant() = 0;
50
51
  virtual Result<HybridTime> WaitForSafeTime(HybridTime safe_time, CoarseTimePoint deadline) = 0;
52
53
  std::string LogPrefix() const;
54
55
  HybridTime Now();
56
57
 protected:
58
74.1k
  ~TransactionParticipantContext() {}
59
};
60
61
} // namespace tablet
62
} // namespace yb
63
64
#endif // YB_TABLET_TRANSACTION_PARTICIPANT_CONTEXT_H