00001 /* Copyright (C) 2003 MySQL AB 00002 00003 This program is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU General Public License as published by 00005 the Free Software Foundation; either version 2 of the License, or 00006 (at your option) any later version. 00007 00008 This program is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License 00014 along with this program; if not, write to the Free Software 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 00016 00017 #ifndef BACKUP_FORMAT_HPP 00018 #define BACKUP_FORMAT_HPP 00019 00020 #include <ndb_types.h> 00021 00022 static const char BACKUP_MAGIC[] = { 'N', 'D', 'B', 'B', 'C', 'K', 'U', 'P' }; 00023 00024 struct BackupFormat { 00025 00029 enum SectionType { 00030 FILE_HEADER = 1, 00031 FRAGMENT_HEADER = 2, 00032 FRAGMENT_FOOTER = 3, 00033 TABLE_LIST = 4, 00034 TABLE_DESCRIPTION = 5, 00035 GCP_ENTRY = 6, 00036 FRAGMENT_INFO = 7 00037 }; 00038 00039 struct FileHeader { 00040 char Magic[8]; 00041 Uint32 NdbVersion; 00042 00043 Uint32 SectionType; 00044 Uint32 SectionLength; 00045 Uint32 FileType; 00046 Uint32 BackupId; 00047 Uint32 BackupKey_0; 00048 Uint32 BackupKey_1; 00049 Uint32 ByteOrder; 00050 }; 00051 00055 enum FileType { 00056 CTL_FILE = 1, 00057 LOG_FILE = 2, 00058 DATA_FILE = 3, 00059 LCP_FILE = 4 00060 }; 00061 00065 struct DataFile { 00066 00067 struct FragmentHeader { 00068 Uint32 SectionType; 00069 Uint32 SectionLength; 00070 Uint32 TableId; 00071 Uint32 FragmentNo; 00072 Uint32 ChecksumType; 00073 }; 00074 00075 struct VariableData { 00076 Uint32 Sz; 00077 Uint32 Id; 00078 Uint32 Data[1]; 00079 }; 00080 00081 struct Record { 00082 Uint32 Length; 00083 Uint32 NullBitmask[1]; 00084 Uint32 DataFixedKeys[1]; 00085 Uint32 DataFixedAttributes[1]; 00086 VariableData DataVariableAttributes[1]; 00087 }; 00088 00089 struct FragmentFooter { 00090 Uint32 SectionType; 00091 Uint32 SectionLength; 00092 Uint32 TableId; 00093 Uint32 FragmentNo; 00094 Uint32 NoOfRecords; 00095 Uint32 Checksum; 00096 }; 00097 }; 00098 00102 struct CtlFile { 00103 00107 struct TableList { 00108 Uint32 SectionType; 00109 Uint32 SectionLength; 00110 Uint32 TableIds[1]; // Length = SectionLength - 2 00111 }; 00112 00116 struct TableDescription { 00117 Uint32 SectionType; 00118 Uint32 SectionLength; 00119 Uint32 TableType; 00120 Uint32 DictTabInfo[1]; // Length = SectionLength - 3 00121 }; 00122 00126 struct GCPEntry { 00127 Uint32 SectionType; 00128 Uint32 SectionLength; 00129 Uint32 StartGCP; 00130 Uint32 StopGCP; 00131 }; 00132 00136 struct FragmentInfo { 00137 Uint32 SectionType; 00138 Uint32 SectionLength; 00139 Uint32 TableId; 00140 Uint32 FragmentNo; 00141 Uint32 NoOfRecordsLow; 00142 Uint32 NoOfRecordsHigh; 00143 Uint32 FilePosLow; 00144 Uint32 FilePosHigh; 00145 }; 00146 }; 00147 00151 struct LogFile { 00152 00156 struct LogEntry { 00157 Uint32 Length; 00158 Uint32 TableId; 00159 // If TriggerEvent & 0x10000 == true then GCI is right after data 00160 Uint32 TriggerEvent; 00161 Uint32 FragId; 00162 Uint32 Data[1]; // Len = Length - 3 00163 }; 00164 00168 struct LogEntry_no_fragid { 00169 Uint32 Length; 00170 Uint32 TableId; 00171 // If TriggerEvent & 0x10000 == true then GCI is right after data 00172 Uint32 TriggerEvent; 00173 Uint32 Data[1]; // Len = Length - 2 00174 }; 00175 }; 00176 00180 struct LcpFile { 00181 CtlFile::TableList TableList; 00182 CtlFile::TableDescription TableDescription; 00183 DataFile::FragmentHeader FragmentHeader; 00184 DataFile::Record Record; 00185 DataFile::FragmentFooter FragmentFooter; 00186 }; 00187 }; 00188 00189 #endif
1.4.7

