MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LqhTransConf.hpp
1 /*
2  Copyright (C) 2003, 2005-2008 MySQL AB, 2008 Sun Microsystems, Inc.
3  All rights reserved. Use is subject to license terms.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; version 2 of the License.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #ifndef LQH_TRANS_CONF_H
20 #define LQH_TRANS_CONF_H
21 
22 #include "SignalData.hpp"
23 
28 class LqhTransConf {
32  friend class Dbtc;
33 
37  friend class Dblqh;
38  friend class DblqhProxy;
39 
40  friend bool printLQH_TRANSCONF(FILE *, const Uint32 *, Uint32, Uint16);
41 public:
42  STATIC_CONST( SignalLength = 17 );
43 
47  STATIC_CONST( SignalLength_GCI_LO = 16 );
48  STATIC_CONST( SignalLength_FRAG_ID = 17 );
49 private:
50 
54  enum OperationStatus {
55  InvalidStatus = 0,
58  LastTransConf = 4,
62  Prepared = 2,
63  Committed = 3,
64  Aborted = 1,
65  Marker = 5
67  };
68 
72  Uint32 tcRef; // 0
73  Uint32 lqhNodeId; // 1
74  Uint32 operationStatus; // 2 See enum OperationStatus
75  Uint32 transId1; // 3
76  Uint32 transId2; // 4
77  Uint32 apiRef; // 5
78  Uint32 apiOpRec; // 6
79  Uint32 lqhConnectPtr;
80  Uint32 oldTcOpRec;
81  Uint32 requestInfo;
82  Uint32 gci_hi;
83  Uint32 nextNodeId1;
84  Uint32 nextNodeId2;
85  Uint32 nextNodeId3;
86  Uint32 tableId;
87  Uint32 gci_lo;
88  Uint32 fragId;
89 
93  static Uint32 getReplicaNo(Uint32 & requestInfo);
94  static Uint32 getReplicaType(Uint32 & requestInfo);
95  static Uint32 getLastReplicaNo(Uint32 & requestInfo);
96  static Uint32 getSimpleFlag(Uint32 & requestInfo);
97  static Uint32 getDirtyFlag(Uint32 & requestInfo);
98  static Uint32 getOperation(Uint32 & requestInfo);
99  static Uint32 getMarkerFlag(Uint32 & requestInfo);
100 
101  static void setReplicaNo(UintR & requestInfo, UintR val);
102  static void setReplicaType(UintR & requestInfo, UintR val);
103  static void setLastReplicaNo(UintR & requestInfo, UintR val);
104  static void setSimpleFlag(UintR & requestInfo, UintR val);
105  static void setDirtyFlag(UintR & requestInfo, UintR val);
106  static void setOperation(UintR & requestInfo, UintR val);
107  static void setMarkerFlag(Uint32 & requestInfo, Uint32 val);
108 };
109 
125 #define LTC_REPLICA_TYPE_SHIFT (0)
126 #define LTC_REPLICA_TYPE_MASK (3)
127 #define LTC_REPLICA_NO_SHIFT (2)
128 #define LTC_REPLICA_NO_MASK (3)
129 #define LTC_LAST_REPLICA_SHIFT (4)
130 #define LTC_LAST_REPLICA_MASK (3)
131 #define LTC_SIMPLE_SHIFT (6)
132 #define LTC_DIRTY_SHIFT (7)
133 #define LTC_OPERATION_SHIFT (8)
134 #define LTC_OPERATION_MASK (7)
135 #define LTC_MARKER_SHIFT (10)
136 
137 inline
138 Uint32
139 LqhTransConf::getReplicaType(Uint32 & requestInfo){
140  return (requestInfo >> LTC_REPLICA_TYPE_SHIFT) & LTC_REPLICA_TYPE_MASK;
141 }
142 
143 inline
144 Uint32
145 LqhTransConf::getReplicaNo(Uint32 & requestInfo){
146  return (requestInfo >> LTC_REPLICA_NO_SHIFT) & LTC_REPLICA_NO_MASK;
147 }
148 
149 inline
150 Uint32
151 LqhTransConf::getLastReplicaNo(Uint32 & requestInfo){
152  return (requestInfo >> LTC_LAST_REPLICA_SHIFT) & LTC_LAST_REPLICA_MASK;
153 }
154 
155 inline
156 Uint32
157 LqhTransConf::getSimpleFlag(Uint32 & requestInfo){
158  return (requestInfo >> LTC_SIMPLE_SHIFT) & 1;
159 }
160 
161 inline
162 Uint32
163 LqhTransConf::getDirtyFlag(Uint32 & requestInfo){
164  return (requestInfo >> LTC_DIRTY_SHIFT) & 1;
165 }
166 
167 inline
168 Uint32
169 LqhTransConf::getOperation(Uint32 & requestInfo){
170  return (requestInfo >> LTC_OPERATION_SHIFT) & LTC_OPERATION_MASK;
171 }
172 
173 inline
174 Uint32
175 LqhTransConf::getMarkerFlag(Uint32 & requestInfo){
176  return (requestInfo >> LTC_MARKER_SHIFT) & 1;
177 }
178 
179 
180 inline
181 void
182 LqhTransConf::setReplicaNo(UintR & requestInfo, UintR val){
183  ASSERT_MAX(val, LTC_REPLICA_NO_MASK, "LqhTransConf::setReplicaNo");
184  requestInfo |= (val << LTC_REPLICA_NO_SHIFT);
185 }
186 
187 inline
188 void
189 LqhTransConf::setReplicaType(UintR & requestInfo, UintR val){
190  ASSERT_MAX(val, LTC_REPLICA_TYPE_MASK, "LqhTransConf::setReplicaType");
191  requestInfo |= (val << LTC_REPLICA_TYPE_SHIFT);
192 }
193 
194 inline
195 void
196 LqhTransConf::setLastReplicaNo(UintR & requestInfo, UintR val){
197  ASSERT_MAX(val, LTC_LAST_REPLICA_MASK, "LqhTransConf::setLastReplicaNo");
198  requestInfo |= (val << LTC_LAST_REPLICA_SHIFT);
199 }
200 
201 inline
202 void
203 LqhTransConf::setSimpleFlag(UintR & requestInfo, UintR val){
204  ASSERT_BOOL(val, "LqhTransConf::setSimpleFlag");
205  requestInfo |= (val << LTC_SIMPLE_SHIFT);
206 }
207 
208 inline
209 void
210 LqhTransConf::setDirtyFlag(UintR & requestInfo, UintR val){
211  ASSERT_BOOL(val, "LqhTransConf::setDirtyFlag");
212  requestInfo |= (val << LTC_DIRTY_SHIFT);
213 }
214 
215 inline
216 void
217 LqhTransConf::setOperation(UintR & requestInfo, UintR val){
218  ASSERT_MAX(val, LTC_OPERATION_MASK, "LqhTransConf::setOperation");
219  requestInfo |= (val << LTC_OPERATION_SHIFT);
220 }
221 
222 inline
223 void
224 LqhTransConf::setMarkerFlag(UintR & requestInfo, UintR val){
225  ASSERT_BOOL(val, "LqhTransConf::setMarkerFlag");
226  requestInfo |= (val << LTC_MARKER_SHIFT);
227 }
228 
229 #endif