/Users/deen/code/yugabyte-db/src/yb/yql/cql/ql/ptree/pt_transaction.h
Line | Count | Source (jump to first uncovered line) |
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 | | // Tree node definitions for TRANSACTION statements. |
16 | | //-------------------------------------------------------------------------------------------------- |
17 | | |
18 | | #ifndef YB_YQL_CQL_QL_PTREE_PT_TRANSACTION_H_ |
19 | | #define YB_YQL_CQL_QL_PTREE_PT_TRANSACTION_H_ |
20 | | |
21 | | #include "yb/common/transaction.pb.h" |
22 | | |
23 | | #include "yb/yql/cql/ql/ptree/list_node.h" |
24 | | #include "yb/yql/cql/ql/ptree/tree_node.h" |
25 | | #include "yb/yql/cql/ql/ptree/pt_select.h" |
26 | | #include "yb/yql/cql/ql/ptree/column_desc.h" |
27 | | #include "yb/yql/cql/ql/ptree/pt_dml.h" |
28 | | |
29 | | namespace yb { |
30 | | namespace ql { |
31 | | |
32 | | //-------------------------------------------------------------------------------------------------- |
33 | | |
34 | | class PTStartTransaction : public TreeNode { |
35 | | public: |
36 | | //------------------------------------------------------------------------------------------------ |
37 | | // Public types. |
38 | | typedef MCSharedPtr<PTStartTransaction> SharedPtr; |
39 | | typedef MCSharedPtr<const PTStartTransaction> SharedPtrConst; |
40 | | |
41 | | //------------------------------------------------------------------------------------------------ |
42 | | // Constructor and destructor. |
43 | | PTStartTransaction(MemoryContext *memctx, YBLocationPtr loc); |
44 | | virtual ~PTStartTransaction(); |
45 | | |
46 | | template<typename... TypeArgs> |
47 | | inline static PTStartTransaction::SharedPtr MakeShared(MemoryContext *memctx, |
48 | 753 | TypeArgs&&... args) { |
49 | 753 | return MCMakeShared<PTStartTransaction>(memctx, std::forward<TypeArgs>(args)...); |
50 | 753 | } |
51 | | |
52 | 54.7k | IsolationLevel isolation_level() const { |
53 | 54.7k | return isolation_level_; |
54 | 54.7k | } |
55 | 0 | void set_isolation_level(const IsolationLevel isolation_level) { |
56 | 0 | isolation_level_ = isolation_level; |
57 | 0 | } |
58 | | |
59 | | // Node semantics analysis. |
60 | | virtual CHECKED_STATUS Analyze(SemContext *sem_context) override; |
61 | | |
62 | | // Node type. |
63 | 219k | virtual TreeNodeOpcode opcode() const override { |
64 | 219k | return TreeNodeOpcode::kPTStartTransaction; |
65 | 219k | } |
66 | | |
67 | | private: |
68 | | IsolationLevel isolation_level_ = SNAPSHOT_ISOLATION; |
69 | | }; |
70 | | |
71 | | class PTCommit : public TreeNode { |
72 | | public: |
73 | | //------------------------------------------------------------------------------------------------ |
74 | | // Public types. |
75 | | typedef MCSharedPtr<PTCommit> SharedPtr; |
76 | | typedef MCSharedPtr<const PTCommit> SharedPtrConst; |
77 | | |
78 | | //------------------------------------------------------------------------------------------------ |
79 | | // Constructor and destructor. |
80 | | PTCommit(MemoryContext *memctx, YBLocationPtr loc); |
81 | | virtual ~PTCommit(); |
82 | | |
83 | | template<typename... TypeArgs> |
84 | | inline static PTCommit::SharedPtr MakeShared(MemoryContext *memctx, |
85 | 754 | TypeArgs&&... args) { |
86 | 754 | return MCMakeShared<PTCommit>(memctx, std::forward<TypeArgs>(args)...); |
87 | 754 | } |
88 | | |
89 | | // Node semantics analysis. |
90 | | virtual CHECKED_STATUS Analyze(SemContext *sem_context) override; |
91 | | |
92 | | // Node type. |
93 | 219k | virtual TreeNodeOpcode opcode() const override { |
94 | 219k | return TreeNodeOpcode::kPTCommit; |
95 | 219k | } |
96 | | }; |
97 | | |
98 | | } // namespace ql |
99 | | } // namespace yb |
100 | | |
101 | | #endif // YB_YQL_CQL_QL_PTREE_PT_TRANSACTION_H_ |