MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
kernel_types.h
1 /*
2  Copyright (C) 2003, 2005, 2006, 2008 MySQL AB, 2010 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 NDB_KERNEL_TYPES_H
20 #define NDB_KERNEL_TYPES_H
21 
22 #include <my_global.h>
23 #include <ndb_types.h>
24 #include "ndb_limits.h"
25 
26 typedef Uint16 NodeId;
27 typedef Uint16 BlockNumber;
28 typedef Uint16 BlockInstance;
29 typedef Uint32 BlockReference;
30 typedef Uint16 GlobalSignalNumber;
31 
32 enum Operation_t {
33  ZREAD = 0
34  ,ZUPDATE = 1
35  ,ZINSERT = 2
36  ,ZDELETE = 3
37  ,ZWRITE = 4
38  ,ZREAD_EX = 5
39  ,ZREFRESH = 6
40  ,ZUNLOCK = 7
41 };
42 
46 struct GlobalPage {
47  union {
48  Uint32 data[GLOBAL_PAGE_SIZE/sizeof(Uint32)];
49  Uint32 nextPool;
50  };
51 };
52 
53 struct Local_key
54 {
55  Uint32 m_page_no;
56  Uint16 m_page_idx;
57  Uint16 m_file_no;
58 
59  bool isNull() const { return m_page_no == RNIL; }
60  void setNull() { m_page_no= RNIL; m_file_no= m_page_idx= ~0;}
61 
62  Uint32 ref() const { return ref(m_page_no,m_page_idx) ;}
63 
64  Local_key& assref (Uint32 ref) {
65  m_page_no = ref2page_id(ref);
66  m_page_idx = ref2page_idx(ref);
67  return *this;
68  }
69 
70  static Uint32 ref(Uint32 lk1, Uint32 lk2) {
71  return (lk1 << MAX_TUPLES_BITS) | lk2;
72  }
73 
74  static Uint32 ref2page_id(Uint32 ref) { return ref >> MAX_TUPLES_BITS; }
75  static Uint32 ref2page_idx(Uint32 ref) { return ref & MAX_TUPLES_PER_PAGE; }
76 
77  static bool isInvalid(Uint32 lk1, Uint32 lk2) {
78  return ref(lk1, lk2) == ~Uint32(0);
79  }
80 };
81 
82 class NdbOut&
83 operator<<(class NdbOut&, const struct Local_key&);
84 
85 inline
86 Uint32
87 table_version_major(Uint32 ver)
88 {
89  return ver & 0x00FFFFFF;
90 }
91 
92 #endif
93 
94 
95 
96