Drizzled Public API Documentation

ha0ha.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002 
00003 Copyright (C) 1994, 2009, 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 ha0ha_h
00028 #define ha0ha_h
00029 
00030 #include "univ.i"
00031 
00032 #include "hash0hash.h"
00033 #include "page0types.h"
00034 #include "buf0types.h"
00035 
00036 /*************************************************************/
00040 UNIV_INLINE
00041 void*
00042 ha_search_and_get_data(
00043 /*===================*/
00044   hash_table_t* table,  
00045   ulint   fold);  
00046 /*********************************************************/
00049 UNIV_INTERN
00050 void
00051 ha_search_and_update_if_found_func(
00052 /*===============================*/
00053   hash_table_t* table,  
00054   ulint   fold, 
00055   void*   data, 
00056 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
00057   buf_block_t*  new_block,
00058 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
00059   void*   new_data);
00061 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
00062 
00069 # define ha_search_and_update_if_found(table,fold,data,new_block,new_data) \
00070   ha_search_and_update_if_found_func(table,fold,data,new_block,new_data)
00071 #else /* UNIV_AHI_DEBUG || UNIV_DEBUG */
00072 
00079 # define ha_search_and_update_if_found(table,fold,data,new_block,new_data) \
00080   ha_search_and_update_if_found_func(table,fold,data,new_data)
00081 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
00082 /*************************************************************/
00086 UNIV_INTERN
00087 hash_table_t*
00088 ha_create_func(
00089 /*===========*/
00090   ulint n,    
00091 #ifdef UNIV_SYNC_DEBUG
00092   ulint mutex_level,  
00094 #endif /* UNIV_SYNC_DEBUG */
00095   ulint n_mutexes); 
00097 #ifdef UNIV_SYNC_DEBUG
00098 
00105 # define ha_create(n_c,n_m,level) ha_create_func(n_c,level,n_m)
00106 #else /* UNIV_SYNC_DEBUG */
00107 
00114 # define ha_create(n_c,n_m,level) ha_create_func(n_c,n_m)
00115 #endif /* UNIV_SYNC_DEBUG */
00116 
00117 /*************************************************************/
00119 UNIV_INTERN
00120 void
00121 ha_clear(
00122 /*=====*/
00123   hash_table_t* table); 
00125 /*************************************************************/
00130 UNIV_INTERN
00131 ibool
00132 ha_insert_for_fold_func(
00133 /*====================*/
00134   hash_table_t* table,  
00135   ulint   fold, 
00139 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
00140   buf_block_t*  block,  
00141 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
00142   void*   data);  
00144 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
00145 
00154 # define ha_insert_for_fold(t,f,b,d) ha_insert_for_fold_func(t,f,b,d)
00155 #else /* UNIV_AHI_DEBUG || UNIV_DEBUG */
00156 
00165 # define ha_insert_for_fold(t,f,b,d) ha_insert_for_fold_func(t,f,d)
00166 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
00167 
00168 /*********************************************************/
00172 UNIV_INLINE
00173 ibool
00174 ha_search_and_delete_if_found(
00175 /*==========================*/
00176   hash_table_t* table,  
00177   ulint   fold, 
00178   void*   data);  
00179 #ifndef UNIV_HOTBACKUP
00180 /*****************************************************************/
00183 UNIV_INTERN
00184 void
00185 ha_remove_all_nodes_to_page(
00186 /*========================*/
00187   hash_table_t* table,  
00188   ulint   fold, 
00189   const page_t* page);  
00190 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
00191 /*************************************************************/
00194 UNIV_INTERN
00195 ibool
00196 ha_validate(
00197 /*========*/
00198   hash_table_t* table,    
00199   ulint   start_index,  
00200   ulint   end_index); 
00201 #endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */
00202 /*************************************************************/
00204 UNIV_INTERN
00205 void
00206 ha_print_info(
00207 /*==========*/
00208   FILE*   file, 
00209   hash_table_t* table); 
00210 #endif /* !UNIV_HOTBACKUP */
00211 
00213 typedef struct ha_node_struct ha_node_t;
00214 
00216 struct ha_node_struct {
00217   ha_node_t*  next; 
00218 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
00219   buf_block_t*  block;  
00220 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
00221   void*   data; 
00222   ulint   fold; 
00223 };
00224 
00225 #ifndef UNIV_HOTBACKUP
00226 
00230 # define ASSERT_HASH_MUTEX_OWN(table, fold)       \
00231   ut_ad(!(table)->mutexes || mutex_own(hash_get_mutex(table, fold)))
00232 #else /* !UNIV_HOTBACKUP */
00233 
00237 # define ASSERT_HASH_MUTEX_OWN(table, fold) ((void) 0)
00238 #endif /* !UNIV_HOTBACKUP */
00239 
00240 #ifndef UNIV_NONINL
00241 #include "ha0ha.ic"
00242 #endif
00243 
00244 #endif