MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CreateEvnt.hpp
1 /*
2  Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #ifndef CREATE_EVNT_HPP
19 #define CREATE_EVNT_HPP
20 
21 #include <ndberror.h>
22 #include "SignalData.hpp"
23 #include <NodeBitmask.hpp>
24 #include <signaldata/DictTabInfo.hpp>
25 #include <AttributeList.hpp>
26 
28 
32 class DropEvntReq {
33  friend bool printDROP_EVNT_REQ(FILE*, const Uint32*, Uint32, Uint16);
34 
35 public:
36  STATIC_CONST( SignalLength = 2 );
37  SECTION( EVENT_NAME_SECTION = 0 );
38 
39  union { // user block reference
40  Uint32 senderRef;
41  Uint32 m_userRef;
42  };
43  union {
44  Uint32 senderData;
45  Uint32 m_userData; // user
46  };
47 
48  Uint32 getUserRef() const {
49  return m_userRef;
50  }
51  void setUserRef(Uint32 val) {
52  m_userRef = val;
53  }
54  Uint32 getUserData() const {
55  return m_userData;
56  }
57  void setUserData(Uint32 val) {
58  m_userData = val;
59  }
60 };
61 
65 class DropEvntConf {
66  friend bool printDROP_EVNT_CONF(FILE*, const Uint32*, Uint32, Uint16);
67 
68 public:
69  STATIC_CONST( SignalLength = 2 );
70 
71  union { // user block reference
72  Uint32 senderRef;
73  Uint32 m_userRef;
74  };
75  union {
76  Uint32 senderData;
77  Uint32 m_userData; // user
78  };
79 
80  Uint32 getUserRef() const {
81  return m_userRef;
82  }
83  void setUserRef(Uint32 val) {
84  m_userRef = val;
85  }
86  Uint32 getUserData() const {
87  return m_userData;
88  }
89  void setUserData(Uint32 val) {
90  m_userData = val;
91  }
92 };
93 
97 class DropEvntRef {
98  friend bool printDROP_EVNT_REF(FILE*, const Uint32*, Uint32, Uint16);
99 
100 public:
101  enum ErrorCode {
102  NoError = 0,
103  Undefined = 1,
104  NF_FakeErrorREF = 11,
105  Busy = 701,
106  NotMaster = 702
107  };
108  STATIC_CONST( SignalLength = 7 );
109  STATIC_CONST( SignalLength2 = SignalLength+1 );
110 
111  union { // user block reference
112  Uint32 senderRef;
113  Uint32 m_userRef;
114  };
115  union {
116  Uint32 senderData;
117  Uint32 m_userData; // user
118  };
119  union {
120  Uint32 errorCode;
121  Uint32 m_errorCode;
122  };
123  Uint32 m_errorLine;
124  Uint32 m_errorNode;
125  // with SignalLength2
126  Uint32 m_masterNodeId;
127  Uint32 getUserRef() const {
128  return m_userRef;
129  }
130  void setUserRef(Uint32 val) {
131  m_userRef = val;
132  }
133  Uint32 getUserData() const {
134  return m_userData;
135  }
136  void setUserData(Uint32 val) {
137  m_userData = val;
138  }
139  Uint32 getErrorCode() const {
140  return m_errorCode;
141  }
142  void setErrorCode(Uint32 val) {
143  m_errorCode = val;
144  }
145  Uint32 getErrorLine() const {
146  return m_errorLine;
147  }
148  void setErrorLine(Uint32 val) {
149  m_errorLine = val;
150  }
151  Uint32 getErrorNode() const {
152  return m_errorNode;
153  }
154  void setErrorNode(Uint32 val) {
155  m_errorNode = val;
156  }
157  Uint32 getMasterNode() const {
158  return m_masterNodeId;
159  }
160  void setMasterNode(Uint32 val) {
161  m_masterNodeId = val;
162  }
163 };
164 
169  friend bool printCREATE_EVNT_REQ(FILE*, const Uint32*, Uint32, Uint16);
170 
171  enum RequestType {
172  RT_UNDEFINED = 0,
173  RT_USER_CREATE = 1,
174  RT_USER_GET = 2,
175 
176  RT_DICT_AFTER_GET = 0x1 << 4
177  // RT_DICT_MASTER = 0x2 << 4,
178 
179  // RT_DICT_COMMIT = 0xC << 4,
180  // RT_DICT_ABORT = 0xF << 4,
181  // RT_TC = 5 << 8
182  };
183  enum EventFlags {
184  EF_REPORT_ALL = 0x1 << 16,
185  EF_REPORT_SUBSCRIBE = 0x2 << 16,
186  EF_NO_REPORT_DDL = 0x4 << 16,
187  EF_ALL = 0xFFFF << 16
188  };
189  STATIC_CONST( SignalLengthGet = 3 );
190  STATIC_CONST( SignalLengthCreate = 6+MAXNROFATTRIBUTESINWORDS_OLD );
191  STATIC_CONST( SignalLength = 8+MAXNROFATTRIBUTESINWORDS_OLD );
192 
193  SECTION( EVENT_NAME_SECTION = 0 );
194  SECTION( ATTRIBUTE_MASK = 1 );
195 
196  union {
197  Uint32 m_userRef; // user block reference
198  Uint32 senderRef; // user block reference
199  };
200  union {
201  Uint32 m_userData; // user
202  Uint32 senderData; // user
203  };
204  Uint32 m_requestInfo;
205  Uint32 m_tableId; // table to event
206  Uint32 m_tableVersion; // table version
207  AttributeMask_OLD::Data m_attrListBitmask;
208  Uint32 m_eventType; // EventFlags (16 bits) + from DictTabInfo::TableType (16 bits)
209  Uint32 m_eventId; // event table id set by DICT/SUMA
210  Uint32 m_eventKey; // event table key set by DICT/SUMA
211  Uint32 getUserRef() const {
212  return m_userRef;
213  }
214  void setUserRef(Uint32 val) {
215  m_userRef = val;
216  }
217  Uint32 getUserData() const {
218  return m_userData;
219  }
220  void setUserData(Uint32 val) {
221  m_userData = val;
222  }
223  CreateEvntReq::RequestType getRequestType() const {
224  const Uint32 val = BitmaskImpl::getField(1, &m_requestInfo, 0, 16);
225  return (CreateEvntReq::RequestType)val;
226  }
227  void setRequestType(CreateEvntReq::RequestType val) {
228  m_requestInfo = (Uint32)val;
229  }
230  Uint32 getRequestFlag() const {
231  return BitmaskImpl::getField(1, &m_requestInfo, 16, 16);
232  };
233  void addRequestFlag(Uint32 val) {
234  val |= BitmaskImpl::getField(1, &m_requestInfo, 16, 16);
235  BitmaskImpl::setField(1, &m_requestInfo, 16, 16, val);
236  };
237  Uint32 getTableId() const {
238  return m_tableId;
239  }
240  void setTableId(Uint32 val) {
241  m_tableId = val;
242  }
243  Uint32 getTableVersion() const {
244  return m_tableVersion;
245  }
246  void setTableVersion(Uint32 val) {
247  m_tableVersion = val;
248  }
249  AttributeMask_OLD getAttrListBitmask() const {
250  AttributeMask_OLD tmp;
251  tmp.assign(m_attrListBitmask);
252  return tmp;
253  }
254  void setAttrListBitmask(const AttributeMask & val) {
255  setAttrListBitmask(val.getSizeInWords(), val.rep.data);
256  }
257  void setAttrListBitmask(const AttributeMask_OLD & val) {
258  setAttrListBitmask(val.getSizeInWords(), val.rep.data);
259  }
260  void setAttrListBitmask(Uint32 sz, const Uint32 data[]){
261  bzero(m_attrListBitmask.data, sizeof(m_attrListBitmask.data));
262  if (sz >= AttributeMask_OLD::Size)
263  {
264  AttributeMask_OLD::assign(m_attrListBitmask.data, data);
265  }
266  else
267  {
268  BitmaskImpl::assign(sz, m_attrListBitmask.data, data);
269  }
270  }
271  Uint32 getEventType() const {
272  return m_eventType & ~EF_ALL;
273  }
274  void setEventType(Uint32 val) {
275  m_eventType = (m_eventType & EF_ALL) | (~EF_ALL & (Uint32)val);
276  }
277  Uint32 getEventId() const {
278  return m_eventId;
279  }
280  void setEventId(Uint32 val) {
281  m_eventId = val;
282  }
283  Uint32 getEventKey() const {
284  return m_eventKey;
285  }
286  void setEventKey(Uint32 val) {
287  m_eventKey = val;
288  }
289  void clearFlags() {
290  m_eventType&= ~EF_ALL;
291  }
292  Uint32 getReportFlags() const {
293  return m_eventType & EF_ALL;
294  }
295  void setReportFlags(Uint32 val) {
296  m_eventType = (val & EF_ALL) | (m_eventType & ~EF_ALL);
297  }
298  Uint32 getReportAll() const {
299  return m_eventType & EF_REPORT_ALL ;
300  }
301  void setReportAll() {
302  m_eventType|= EF_REPORT_ALL;
303  }
304  Uint32 getReportSubscribe() const {
305  return m_eventType & EF_REPORT_SUBSCRIBE ;
306  }
307  void setReportSubscribe() {
308  m_eventType|= EF_REPORT_SUBSCRIBE;
309  }
310  Uint32 getReportDDL() const {
311  return (m_eventType & EF_NO_REPORT_DDL) == 0;
312  }
313  void setReportDDL() {
314  m_eventType &= ~(Uint32)EF_NO_REPORT_DDL;
315  }
316  void clearReportDDL() {
317  m_eventType |= EF_NO_REPORT_DDL;
318  }
319 };
320 
325  friend bool printCREATE_EVNT_CONF(FILE*, const Uint32*, Uint32, Uint16);
326 
327 public:
328  // STATIC_CONST( InternalLength = 3 );
329  STATIC_CONST( SignalLength = 8+MAXNROFATTRIBUTESINWORDS_OLD );
330 
331  union {
332  Uint32 m_userRef; // user block reference
333  Uint32 senderRef; // user block reference
334  };
335  union {
336  Uint32 m_userData; // user
337  Uint32 senderData; // user
338  };
339  Uint32 m_requestInfo;
340  Uint32 m_tableId;
341  Uint32 m_tableVersion; // table version
342  AttributeMask_OLD m_attrListBitmask;
343  Uint32 m_eventType;
344  Uint32 m_eventId;
345  Uint32 m_eventKey;
346 
347  Uint32 getUserRef() const {
348  return m_userRef;
349  }
350  void setUserRef(Uint32 val) {
351  m_userRef = val;
352  }
353  Uint32 getUserData() const {
354  return m_userData;
355  }
356  void setUserData(Uint32 val) {
357  m_userData = val;
358  }
359  CreateEvntReq::RequestType getRequestType() const {
360  return (CreateEvntReq::RequestType)m_requestInfo;
361  }
362  void setRequestType(CreateEvntReq::RequestType val) {
363  m_requestInfo = (Uint32)val;
364  }
365  Uint32 getTableId() const {
366  return m_tableId;
367  }
368  void setTableId(Uint32 val) {
369  m_tableId = val;
370  }
371  Uint32 getTableVersion() const {
372  return m_tableVersion;
373  }
374  void setTableVersion(Uint32 val) {
375  m_tableVersion = val;
376  }
377  AttributeMask_OLD getAttrListBitmask() const {
378  return m_attrListBitmask;
379  }
380  void setAttrListBitmask(const AttributeMask_OLD & val) {
381  m_attrListBitmask = val;
382  }
383  Uint32 getEventType() const {
384  return m_eventType;
385  }
386  void setEventType(Uint32 val) {
387  m_eventType = (Uint32)val;
388  }
389  Uint32 getEventId() const {
390  return m_eventId;
391  }
392  void setEventId(Uint32 val) {
393  m_eventId = val;
394  }
395  Uint32 getEventKey() const {
396  return m_eventKey;
397  }
398  void setEventKey(Uint32 val) {
399  m_eventKey = val;
400  }
401 };
402 
407  friend class SafeCounter;
408  friend bool printCREATE_EVNT_REF(FILE*, const Uint32*, Uint32, Uint16);
409 
410  STATIC_CONST( SignalLength = 11 );
411  STATIC_CONST( SignalLength2 = SignalLength + 1 );
412  enum ErrorCode {
413  NoError = 0,
414  Undefined = 1,
415  NF_FakeErrorREF = 11,
416  Busy = 701,
417  NotMaster = 702
418  };
419  union {
420  Uint32 m_userRef; // user block reference
421  Uint32 senderRef; // user block reference
422  };
423  union {
424  Uint32 m_userData; // user
425  Uint32 senderData; // user
426  };
427 
428  Uint32 m_requestInfo;
429  Uint32 m_tableId;
430  Uint32 m_tableVersion; // table version
431  Uint32 m_eventType;
432  Uint32 m_eventId;
433  Uint32 m_eventKey;
434  Uint32 errorCode;
435  Uint32 m_errorLine;
436  Uint32 m_errorNode;
437  // with SignalLength2
438  Uint32 m_masterNodeId;
439  Uint32 getUserRef() const {
440  return m_userRef;
441  }
442  void setUserRef(Uint32 val) {
443  m_userRef = val;
444  }
445  Uint32 getUserData() const {
446  return m_userData;
447  }
448  void setUserData(Uint32 val) {
449  m_userData = val;
450  }
451  CreateEvntReq::RequestType getRequestType() const {
452  return (CreateEvntReq::RequestType)m_requestInfo;
453  }
454  void setRequestType(CreateEvntReq::RequestType val) {
455  m_requestInfo = (Uint32)val;
456  }
457  Uint32 getTableId() const {
458  return m_tableId;
459  }
460  void setTableId(Uint32 val) {
461  m_tableId = val;
462  }
463  Uint32 getTableVersion() const {
464  return m_tableVersion;
465  }
466  void setTableVersion(Uint32 val) {
467  m_tableVersion = val;
468  }
469 
470  Uint32 getEventType() const {
471  return m_eventType;
472  }
473  void setEventType(Uint32 val) {
474  m_eventType = (Uint32)val;
475  }
476  Uint32 getEventId() const {
477  return m_eventId;
478  }
479  void setEventId(Uint32 val) {
480  m_eventId = val;
481  }
482  Uint32 getEventKey() const {
483  return m_eventKey;
484  }
485  void setEventKey(Uint32 val) {
486  m_eventKey = val;
487  }
488 
489  Uint32 getErrorCode() const {
490  return errorCode;
491  }
492  void setErrorCode(Uint32 val) {
493  errorCode = val;
494  }
495  Uint32 getErrorLine() const {
496  return m_errorLine;
497  }
498  void setErrorLine(Uint32 val) {
499  m_errorLine = val;
500  }
501  Uint32 getErrorNode() const {
502  return m_errorNode;
503  }
504  void setErrorNode(Uint32 val) {
505  m_errorNode = val;
506  }
507  Uint32 getMasterNode() const {
508  return m_masterNodeId;
509  }
510  void setMasterNode(Uint32 val) {
511  m_masterNodeId = val;
512  }
513 };
514 #endif