1 /*
2    Copyright (C) 2005-2008 MySQL AB, 2009 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, version 2.0,
7    as published by the Free Software Foundation.
8 
9    This program is also distributed with certain software (including
10    but not limited to OpenSSL) that is licensed under separate terms,
11    as designated in a particular file or component or in included license
12    documentation.  The authors of MySQL hereby grant you an additional
13    permission to link the program and your derivative works with the
14    separately licensed software that they have included with MySQL.
15 
16    This program is distributed in the hope that it will be useful,
17    but WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19    GNU General Public License, version 2.0, for more details.
20 
21    You should have received a copy of the GNU General Public License
22    along with this program; if not, write to the Free Software
23    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
24 */
25 
26 #ifndef CREATE_FILEGROUP_IMPL_HPP
27 #define CREATE_FILEGROUP_IMPL_HPP
28 
29 #include "SignalData.hpp"
30 
31 struct CreateFilegroupImplReq {
32   /**
33    * Sender(s) / Reciver(s)
34    */
35   friend class Dbdict;
36   friend class Tsman;
37   friend class Lgman;
38 
39   /**
40    * For printing
41    */
42   friend bool printCREATE_FILEGROUP_IMPL_REQ(FILE*, const Uint32*, Uint32, Uint16);
43 
44   STATIC_CONST( SignalLength = 5 ); // DICT2DICT
45   STATIC_CONST( TablespaceLength = 7 );
46   STATIC_CONST( LogfileGroupLength = 6 );
47 
48   Uint32 senderData;
49   Uint32 senderRef;
50   Uint32 filegroup_id;
51   Uint32 filegroup_version;
52   Uint32 requestType;
53 
54   union {
55     struct {
56       Uint32 extent_size;
57       Uint32 logfile_group_id;
58     } tablespace;
59     struct {
60       Uint32 buffer_size; // In pages
61     } logfile_group;
62   };
63 };
64 
65 struct CreateFilegroupImplRef {
66   /**
67    * Sender(s)
68    */
69   friend class Dbdict;
70   friend class Tsman;
71   friend class Lgman;
72 
73   /**
74    * For printing
75    */
76   friend bool printCREATE_FILEGROUP_IMPL_REF(FILE*, const Uint32*, Uint32, Uint16);
77 
78   STATIC_CONST( SignalLength = 3 );
79 
80   enum ErrorCode {
81     NoError = 0,
82     FilegroupAlreadyExists = 1502,
83     OutOfFilegroupRecords = 1503,
84     OutOfLogBufferMemory = 1504,
85     OneLogfileGroupLimit = 1514
86   };
87 
88   Uint32 senderData;
89   Uint32 senderRef;
90   Uint32 errorCode;
91 };
92 
93 struct CreateFilegroupImplConf {
94   /**
95    * Sender(s)
96    */
97   friend class Dbdict;
98   friend class Tsman;
99   friend class Lgman;
100 
101   /**
102    * For printing
103    */
104   friend bool printCREATE_FILEGROUP_IMPL_CONF(FILE*, const Uint32*, Uint32, Uint16);
105 
106   STATIC_CONST( SignalLength = 2 );
107 
108   Uint32 senderData;
109   Uint32 senderRef;
110 };
111 
112 struct CreateFileImplReq {
113   /**
114    * Sender(s) / Reciver(s)
115    */
116   friend class Dbdict;
117   friend class Tsman;
118   friend class Lgman;
119 
120   /**
121    * For printing
122    */
123   friend bool printCREATE_FILE_IMPL_REQ(FILE*, const Uint32*, Uint32, Uint16);
124 
125   STATIC_CONST( SignalLength = 11 ); // DICT2DICT
126   STATIC_CONST( DatafileLength = 10 );
127   STATIC_CONST( UndofileLength = 9 );
128   STATIC_CONST( CommitLength = 7 );
129   STATIC_CONST( AbortLength = 7 );
130   SECTION( FILENAME = 0 );
131 
132   enum RequestInfo {
133     Create = 0x1,
134     CreateForce = 0x2,
135     Open = 0x4,
136     Commit = 0x8,
137     Abort = 0x10
138   };
139 
140   Uint32 senderData;
141   Uint32 senderRef;
142   Uint32 requestInfo;
143   Uint32 file_id;
144   Uint32 file_version;
145   Uint32 filegroup_id;
146   Uint32 filegroup_version;
147   Uint32 file_size_hi;
148   Uint32 file_size_lo;
149 
150   union {
151     struct {
152       Uint32 extent_size;
153     } tablespace;
154   };
155   Uint32 requestType;
156 };
157 
158 struct CreateFileImplRef {
159   friend class Dbdict;
160   friend class Tsman;
161   friend class Lgman;
162 
163   /**
164    * For printing
165    */
166   friend bool printCREATE_FILE_IMPL_REF(FILE*, const Uint32*, Uint32, Uint16);
167 
168   STATIC_CONST( SignalLength = 5 );
169 
170   enum ErrorCode {
171     NoError = 0,
172     InvalidFilegroup = 1505,
173     InvalidFilegroupVersion = 1506,
174     FileNoAlreadyExists = 1507,
175     OutOfFileRecords = 1508,
176     FileError = 1509,
177     InvalidFileMetadata = 1510,
178     OutOfMemory = 1511,
179     FileReadError = 1512,
180     FilegroupNotOnline = 1513,
181     FileSizeTooLarge = 1515,
182     FileSizeTooSmall = 1516
183   };
184 
185   Uint32 senderData;
186   Uint32 senderRef;
187   Uint32 errorCode;
188   Uint32 fsErrCode;
189   Uint32 osErrCode;
190 };
191 
192 struct CreateFileImplConf {
193   friend class Dbdict;
194   friend class Tsman;
195   friend class Lgman;
196 
197 
198   /**
199    * For printing
200    */
201   friend bool printCREATE_FILE_IMPL_CONF(FILE*, const Uint32*, Uint32, Uint16);
202 
203   STATIC_CONST( SignalLength = 4 );
204 
205   Uint32 senderData;
206   Uint32 senderRef;
207 };
208 
209 #endif
210