Drizzled Public API Documentation

ha0ha.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (C) 1994, 2009, Innobase Oy. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free Software
7 Foundation; version 2 of the License.
8 
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15 St, Fifth Floor, Boston, MA 02110-1301 USA
16 
17 *****************************************************************************/
18 
19 /**************************************************/
26 #pragma once
27 #ifndef ha0ha_h
28 #define ha0ha_h
29 
30 #include "univ.i"
31 
32 #include "hash0hash.h"
33 #include "page0types.h"
34 #include "buf0types.h"
35 
36 /*************************************************************/
40 UNIV_INLINE
41 void*
43 /*===================*/
44  hash_table_t* table,
45  ulint fold);
46 /*********************************************************/
49 UNIV_INTERN
50 void
51 ha_search_and_update_if_found_func(
52 /*===============================*/
53  hash_table_t* table,
54  ulint fold,
55  void* data,
56 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
57  buf_block_t* new_block,
58 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
59  void* new_data);
61 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
62 
69 # define ha_search_and_update_if_found(table,fold,data,new_block,new_data) \
70  ha_search_and_update_if_found_func(table,fold,data,new_block,new_data)
71 #else /* UNIV_AHI_DEBUG || UNIV_DEBUG */
72 
79 # define ha_search_and_update_if_found(table,fold,data,new_block,new_data) \
80  ha_search_and_update_if_found_func(table,fold,data,new_data)
81 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
82 /*************************************************************/
86 UNIV_INTERN
88 ha_create_func(
89 /*===========*/
90  ulint n,
91 #ifdef UNIV_SYNC_DEBUG
92  ulint mutex_level,
94 #endif /* UNIV_SYNC_DEBUG */
95  ulint n_mutexes);
97 #ifdef UNIV_SYNC_DEBUG
98 
105 # define ha_create(n_c,n_m,level) ha_create_func(n_c,level,n_m)
106 #else /* UNIV_SYNC_DEBUG */
107 
114 # define ha_create(n_c,n_m,level) ha_create_func(n_c,n_m)
115 #endif /* UNIV_SYNC_DEBUG */
116 
117 /*************************************************************/
119 UNIV_INTERN
120 void
121 ha_clear(
122 /*=====*/
123  hash_table_t* table);
125 /*************************************************************/
130 UNIV_INTERN
131 ibool
132 ha_insert_for_fold_func(
133 /*====================*/
134  hash_table_t* table,
135  ulint fold,
139 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
140  buf_block_t* block,
141 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
142  void* data);
144 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
145 
154 # define ha_insert_for_fold(t,f,b,d) ha_insert_for_fold_func(t,f,b,d)
155 #else /* UNIV_AHI_DEBUG || UNIV_DEBUG */
156 
165 # define ha_insert_for_fold(t,f,b,d) ha_insert_for_fold_func(t,f,d)
166 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
167 
168 /*********************************************************/
172 UNIV_INLINE
173 ibool
175 /*==========================*/
176  hash_table_t* table,
177  ulint fold,
178  void* data);
179 #ifndef UNIV_HOTBACKUP
180 /*****************************************************************/
183 UNIV_INTERN
184 void
185 ha_remove_all_nodes_to_page(
186 /*========================*/
187  hash_table_t* table,
188  ulint fold,
189  const page_t* page);
190 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
191 /*************************************************************/
194 UNIV_INTERN
195 ibool
196 ha_validate(
197 /*========*/
198  hash_table_t* table,
199  ulint start_index,
200  ulint end_index);
201 #endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */
202 /*************************************************************/
204 UNIV_INTERN
205 void
206 ha_print_info(
207 /*==========*/
208  FILE* file,
209  hash_table_t* table);
210 #endif /* !UNIV_HOTBACKUP */
211 
213 typedef struct ha_node_struct ha_node_t;
214 
218 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
219  buf_block_t* block;
220 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
221  void* data;
222  ulint fold;
223 };
224 
225 #ifndef UNIV_HOTBACKUP
226 
230 # define ASSERT_HASH_MUTEX_OWN(table, fold) \
231  ut_ad(!(table)->mutexes || mutex_own(hash_get_mutex(table, fold)))
232 #else /* !UNIV_HOTBACKUP */
233 
237 # define ASSERT_HASH_MUTEX_OWN(table, fold) ((void) 0)
238 #endif /* !UNIV_HOTBACKUP */
239 
240 #ifndef UNIV_NONINL
241 #include "ha0ha.ic"
242 #endif
243 
244 #endif