Drizzled Public API Documentation

dict0boot.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002 
00003 Copyright (C) 1996, 2010, Innobase Oy. All Rights Reserved.
00004 
00005 This program is free software; you can redistribute it and/or modify it under
00006 the terms of the GNU General Public License as published by the Free Software
00007 Foundation; version 2 of the License.
00008 
00009 This program is distributed in the hope that it will be useful, but WITHOUT
00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
00012 
00013 You should have received a copy of the GNU General Public License along with
00014 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
00015 St, Fifth Floor, Boston, MA 02110-1301 USA
00016 
00017 *****************************************************************************/
00018 
00019 /**************************************************/
00026 #pragma once
00027 #ifndef dict0boot_h
00028 #define dict0boot_h
00029 
00030 #include "univ.i"
00031 
00032 #include "mtr0mtr.h"
00033 #include "mtr0log.h"
00034 #include "ut0byte.h"
00035 #include "buf0buf.h"
00036 #include "fsp0fsp.h"
00037 #include "dict0dict.h"
00038 
00039 typedef byte  dict_hdr_t;
00040 
00041 /**********************************************************************/
00044 UNIV_INTERN
00045 dict_hdr_t*
00046 dict_hdr_get(
00047 /*=========*/
00048   mtr_t*  mtr); 
00049 /**********************************************************************/
00051 UNIV_INTERN
00052 void
00053 dict_hdr_get_new_id(
00054 /*================*/
00055   table_id_t* table_id, 
00057   index_id_t* index_id, 
00059   ulint*    space_id);  
00061 /**********************************************************************/
00064 UNIV_INLINE
00065 row_id_t
00066 dict_sys_get_new_row_id(void);
00067 /*=========================*/
00068 /**********************************************************************/
00071 UNIV_INLINE
00072 row_id_t
00073 dict_sys_read_row_id(
00074 /*=================*/
00075   const byte* field); 
00076 /**********************************************************************/
00078 UNIV_INLINE
00079 void
00080 dict_sys_write_row_id(
00081 /*==================*/
00082   byte*   field,  
00083   row_id_t  row_id);
00084 /*****************************************************************/
00087 UNIV_INTERN
00088 void
00089 dict_boot(void);
00090 /*===========*/
00091 /*****************************************************************/
00093 UNIV_INTERN
00094 void
00095 dict_create(void);
00096 /*=============*/
00097 
00098 
00099 /* Space id and page no where the dictionary header resides */
00100 #define DICT_HDR_SPACE    0 /* the SYSTEM tablespace */
00101 #define DICT_HDR_PAGE_NO  FSP_DICT_HDR_PAGE_NO
00102 
00103 /* The ids for the basic system tables and their indexes */
00104 #define DICT_TABLES_ID    1
00105 #define DICT_COLUMNS_ID   2
00106 #define DICT_INDEXES_ID   3
00107 #define DICT_FIELDS_ID    4
00108 /* The following is a secondary index on SYS_TABLES */
00109 #define DICT_TABLE_IDS_ID 5
00110 
00111 #define DICT_HDR_FIRST_ID 10  /* the ids for tables etc. start
00112           from this number, except for basic
00113           system tables and their above defined
00114           indexes; ibuf tables and indexes are
00115           assigned as the id the number
00116           DICT_IBUF_ID_MIN plus the space id */
00117 #define DICT_IBUF_ID_MIN  0xFFFFFFFF00000000ULL
00118 
00119 /* The offset of the dictionary header on the page */
00120 #define DICT_HDR    FSEG_PAGE_DATA
00121 
00122 /*-------------------------------------------------------------*/
00123 /* Dictionary header offsets */
00124 #define DICT_HDR_ROW_ID   0 /* The latest assigned row id */
00125 #define DICT_HDR_TABLE_ID 8 /* The latest assigned table id */
00126 #define DICT_HDR_INDEX_ID 16  /* The latest assigned index id */
00127 #define DICT_HDR_MAX_SPACE_ID 24  /* The latest assigned space id, or 0*/
00128 #define DICT_HDR_MIX_ID_LOW 28  /* Obsolete,always DICT_HDR_FIRST_ID */
00129 #define DICT_HDR_TABLES   32  /* Root of the table index tree */
00130 #define DICT_HDR_TABLE_IDS  36  /* Root of the table index tree */
00131 #define DICT_HDR_COLUMNS  40  /* Root of the column index tree */
00132 #define DICT_HDR_INDEXES  44  /* Root of the index index tree */
00133 #define DICT_HDR_FIELDS   48  /* Root of the index field
00134           index tree */
00135 
00136 #define DICT_HDR_FSEG_HEADER  56  /* Segment header for the tablespace
00137           segment into which the dictionary
00138           header is created */
00139 /*-------------------------------------------------------------*/
00140 
00141 /* The field number of the page number field in the sys_indexes table
00142 clustered index */
00143 #define DICT_SYS_INDEXES_PAGE_NO_FIELD   8
00144 #define DICT_SYS_INDEXES_SPACE_NO_FIELD  7
00145 #define DICT_SYS_INDEXES_TYPE_FIELD  6
00146 #define DICT_SYS_INDEXES_NAME_FIELD  4
00147 
00148 /* When a row id which is zero modulo this number (which must be a power of
00149 two) is assigned, the field DICT_HDR_ROW_ID on the dictionary header page is
00150 updated */
00151 #define DICT_HDR_ROW_ID_WRITE_MARGIN  256
00152 
00153 #ifndef UNIV_NONINL
00154 #include "dict0boot.ic"
00155 #endif
00156 
00157 #endif