/Users/deen/code/yugabyte-db/src/yb/tablet/remove_intents_task.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_TABLET_REMOVE_INTENTS_TASK_H |
15 | | #define YB_TABLET_REMOVE_INTENTS_TASK_H |
16 | | |
17 | | #include "yb/rpc/strand.h" |
18 | | |
19 | | #include "yb/tablet/running_transaction_context.h" |
20 | | |
21 | | namespace yb { |
22 | | namespace tablet { |
23 | | |
24 | | // Used by RunningTransaction to remove its intents. |
25 | | class RemoveIntentsTask : public rpc::StrandTask { |
26 | | public: |
27 | | RemoveIntentsTask(TransactionIntentApplier* applier, |
28 | | TransactionParticipantContext* participant_context, |
29 | | RunningTransactionContext* running_transaction_context, |
30 | | const TransactionId& id); |
31 | | |
32 | | bool Prepare(RunningTransactionPtr transaction); |
33 | | void Run() override; |
34 | | void Done(const Status& status) override; |
35 | | |
36 | 1.67M | virtual ~RemoveIntentsTask() = default; |
37 | | |
38 | | private: |
39 | | std::string LogPrefix() const; |
40 | | |
41 | | TransactionIntentApplier& applier_; |
42 | | TransactionParticipantContext& participant_context_; |
43 | | RunningTransactionContext& running_transaction_context_; |
44 | | TransactionId id_; |
45 | | std::atomic<bool> used_{false}; |
46 | | RunningTransactionPtr transaction_; |
47 | | }; |
48 | | |
49 | | } // namespace tablet |
50 | | } // namespace yb |
51 | | |
52 | | #endif // YB_TABLET_REMOVE_INTENTS_TASK_H |