InnoDB Plugin
1.0
|
#include "univ.i"
#include "mem0mem.h"
#include "sync0sync.h"
#include "sync0rw.h"
#include "hash0hash.ic"
Go to the source code of this file.
Data Structures | |
struct | hash_cell_t |
struct | hash_table_t |
Macros | |
#define | hash_create hash0_create |
#define | hash_create_sync_obj(t, s, n, level) hash_create_sync_obj_func(t, s, level, n) |
#define | HASH_ASSERT_OWN(TABLE, FOLD) |
#define | HASH_INSERT(TYPE, NAME, TABLE, FOLD, DATA) |
#define | HASH_ASSERT_VALID(DATA) do {} while (0) |
#define | HASH_INVALIDATE(DATA, NAME) do {} while (0) |
#define | HASH_DELETE(TYPE, NAME, TABLE, FOLD, DATA) |
#define | HASH_GET_FIRST(TABLE, HASH_VAL) (hash_get_nth_cell(TABLE, HASH_VAL)->node) |
#define | HASH_GET_NEXT(NAME, DATA) ((DATA)->NAME) |
#define | HASH_SEARCH(NAME, TABLE, FOLD, TYPE, DATA, ASSERTION, TEST) |
#define | HASH_SEARCH_ALL(NAME, TABLE, TYPE, DATA, ASSERTION, TEST) |
#define | HASH_DELETE_AND_COMPACT(TYPE, NAME, TABLE, NODE) |
#define | HASH_MIGRATE(OLD_TABLE, NEW_TABLE, NODE_TYPE, PTR_NAME, FOLD_FUNC) |
#define | HASH_TABLE_MAGIC_N 76561114 |
Typedefs | |
typedef void * | hash_node_t |
Enumerations | |
enum | hash_table_sync_t { HASH_TABLE_SYNC_NONE = 0, HASH_TABLE_SYNC_MUTEX, HASH_TABLE_SYNC_RW_LOCK } |
Functions | |
UNIV_INTERN hash_table_t * | hash_create (ulint n) |
UNIV_INTERN void | hash_create_sync_obj_func (hash_table_t *table, enum hash_table_sync_t type, ulint sync_level, ulint n_sync_obj) |
UNIV_INTERN void | hash_table_free (hash_table_t *table) |
UNIV_INLINE ulint | hash_calc_hash (ulint fold, hash_table_t *table) |
UNIV_INLINE hash_cell_t * | hash_get_nth_cell (hash_table_t *table, ulint n) |
UNIV_INLINE void | hash_table_clear (hash_table_t *table) |
UNIV_INLINE ulint | hash_get_n_cells (hash_table_t *table) |
UNIV_INLINE ulint | hash_get_sync_obj_index (hash_table_t *table, ulint fold) |
UNIV_INLINE mem_heap_t * | hash_get_nth_heap (hash_table_t *table, ulint i) |
UNIV_INLINE mem_heap_t * | hash_get_heap (hash_table_t *table, ulint fold) |
UNIV_INLINE ib_mutex_t * | hash_get_nth_mutex (hash_table_t *table, ulint i) |
UNIV_INLINE rw_lock_t * | hash_get_nth_lock (hash_table_t *table, ulint i) |
UNIV_INLINE ib_mutex_t * | hash_get_mutex (hash_table_t *table, ulint fold) |
UNIV_INLINE rw_lock_t * | hash_get_lock (hash_table_t *table, ulint fold) |
UNIV_INTERN void | hash_mutex_enter (hash_table_t *table, ulint fold) |
UNIV_INTERN void | hash_mutex_exit (hash_table_t *table, ulint fold) |
UNIV_INTERN void | hash_mutex_enter_all (hash_table_t *table) |
UNIV_INTERN void | hash_mutex_exit_all (hash_table_t *table) |
UNIV_INTERN void | hash_mutex_exit_all_but (hash_table_t *table, ib_mutex_t *keep_mutex) |
UNIV_INTERN void | hash_lock_s (hash_table_t *table, ulint fold) |
UNIV_INTERN void | hash_lock_x (hash_table_t *table, ulint fold) |
UNIV_INTERN void | hash_unlock_s (hash_table_t *table, ulint fold) |
UNIV_INTERN void | hash_unlock_x (hash_table_t *table, ulint fold) |
UNIV_INTERN void | hash_lock_x_all (hash_table_t *table) |
UNIV_INTERN void | hash_unlock_x_all (hash_table_t *table) |
UNIV_INTERN void | hash_unlock_x_all_but (hash_table_t *table, rw_lock_t *keep_lock) |
The simple hash table utility
Created 5/20/1997 Heikki Tuuri
#define HASH_ASSERT_OWN | ( | TABLE, | |
FOLD | |||
) |
Assert that the mutex for the table is held
#define HASH_DELETE | ( | TYPE, | |
NAME, | |||
TABLE, | |||
FOLD, | |||
DATA | |||
) |
Deletes a struct from a hash table.
#define HASH_DELETE_AND_COMPACT | ( | TYPE, | |
NAME, | |||
TABLE, | |||
NODE | |||
) |
Deletes a struct which is stored in the heap of the hash table, and compacts the heap. The fold value must be stored in the struct NODE in a field named 'fold'.
#define HASH_GET_FIRST | ( | TABLE, | |
HASH_VAL | |||
) | (hash_get_nth_cell(TABLE, HASH_VAL)->node) |
Gets the first struct in a hash chain, NULL if none.
#define HASH_GET_NEXT | ( | NAME, | |
DATA | |||
) | ((DATA)->NAME) |
Gets the next struct in a hash chain, NULL if none.
#define HASH_INSERT | ( | TYPE, | |
NAME, | |||
TABLE, | |||
FOLD, | |||
DATA | |||
) |
Inserts a struct to a hash table.
#define HASH_MIGRATE | ( | OLD_TABLE, | |
NEW_TABLE, | |||
NODE_TYPE, | |||
PTR_NAME, | |||
FOLD_FUNC | |||
) |
Move all hash table entries from OLD_TABLE to NEW_TABLE.
#define HASH_SEARCH | ( | NAME, | |
TABLE, | |||
FOLD, | |||
TYPE, | |||
DATA, | |||
ASSERTION, | |||
TEST | |||
) |
Looks for a struct in a hash table.
#define HASH_SEARCH_ALL | ( | NAME, | |
TABLE, | |||
TYPE, | |||
DATA, | |||
ASSERTION, | |||
TEST | |||
) |
Looks for an item in all hash buckets.
enum hash_table_sync_t |
UNIV_INLINE ulint hash_calc_hash | ( | ulint | fold, |
hash_table_t * | table | ||
) |
Calculates the hash value from a folded value.
Calculates the hash value from a folded value.
fold | in: folded value |
table | in: hash table |
UNIV_INTERN hash_table_t* hash_create | ( | ulint | n | ) |
Creates a hash table with >= n array cells. The actual number of cells is chosen to be a prime number slightly bigger than n.
UNIV_INTERN void hash_create_sync_obj_func | ( | hash_table_t * | table, |
enum hash_table_sync_t | type, | ||
ulint | sync_level, | ||
ulint | n_sync_obj | ||
) |
Creates a sync object array array to protect a hash table. ::sync_obj can be mutexes or rw_locks depening on the type of hash table. in: number of sync objects, must be a power of 2
table | in: hash table |
type | in: HASH_TABLE_SYNC_MUTEX or HASH_TABLE_SYNC_RW_LOCK |
sync_level | in: latching order level of the mutexes: used in the debug version |
UNIV_INLINE mem_heap_t* hash_get_heap | ( | hash_table_t * | table, |
ulint | fold | ||
) |
Gets the heap for a fold value in a hash table.
Gets the heap for a fold value in a hash table.
table | in: hash table |
fold | in: fold |
UNIV_INLINE rw_lock_t* hash_get_lock | ( | hash_table_t * | table, |
ulint | fold | ||
) |
Gets the rw_lock for a fold value in a hash table.
Gets the rw_lock for a fold value in a hash table.
table | in: hash table |
fold | in: fold |
UNIV_INLINE ib_mutex_t* hash_get_mutex | ( | hash_table_t * | table, |
ulint | fold | ||
) |
Gets the mutex for a fold value in a hash table.
Gets the mutex for a fold value in a hash table.
table | in: hash table |
fold | in: fold |
UNIV_INLINE ulint hash_get_n_cells | ( | hash_table_t * | table | ) |
Returns the number of cells in a hash table.
Returns the number of cells in a hash table.
table | in: table |
UNIV_INLINE hash_cell_t* hash_get_nth_cell | ( | hash_table_t * | table, |
ulint | n | ||
) |
Gets the nth cell in a hash table.
Gets the nth cell in a hash table.
table | in: hash table |
n | in: cell index |
UNIV_INLINE mem_heap_t* hash_get_nth_heap | ( | hash_table_t * | table, |
ulint | i | ||
) |
Gets the nth heap in a hash table.
Gets the nth heap in a hash table.
table | in: hash table |
i | in: index of the heap |
UNIV_INLINE rw_lock_t* hash_get_nth_lock | ( | hash_table_t * | table, |
ulint | i | ||
) |
Gets the nth rw_lock in a hash table.
Gets the nth rw_lock in a hash table.
table | in: hash table |
i | in: index of the rw_lock |
UNIV_INLINE ib_mutex_t* hash_get_nth_mutex | ( | hash_table_t * | table, |
ulint | i | ||
) |
Gets the nth mutex in a hash table.
Gets the nth mutex in a hash table.
table | in: hash table |
i | in: index of the mutex |
UNIV_INLINE ulint hash_get_sync_obj_index | ( | hash_table_t * | table, |
ulint | fold | ||
) |
Gets the sync object index for a fold value in a hash table.
Gets the sync object index for a fold value in a hash table.
table | in: hash table |
fold | in: fold |
UNIV_INTERN void hash_lock_s | ( | hash_table_t * | table, |
ulint | fold | ||
) |
s-lock a lock for a fold value in a hash table. in: fold
table | in: hash table |
UNIV_INTERN void hash_lock_x | ( | hash_table_t * | table, |
ulint | fold | ||
) |
x-lock a lock for a fold value in a hash table. in: fold
table | in: hash table |
UNIV_INTERN void hash_lock_x_all | ( | hash_table_t * | table | ) |
Reserves all the locks of a hash table, in an ascending order. in: hash table
UNIV_INTERN void hash_mutex_enter | ( | hash_table_t * | table, |
ulint | fold | ||
) |
Reserves the mutex for a fold value in a hash table. in: fold
table | in: hash table |
UNIV_INTERN void hash_mutex_enter_all | ( | hash_table_t * | table | ) |
Reserves all the mutexes of a hash table, in an ascending order. in: hash table
UNIV_INTERN void hash_mutex_exit | ( | hash_table_t * | table, |
ulint | fold | ||
) |
Releases the mutex for a fold value in a hash table. in: fold
table | in: hash table |
UNIV_INTERN void hash_mutex_exit_all | ( | hash_table_t * | table | ) |
Releases all the mutexes of a hash table. in: hash table
UNIV_INTERN void hash_mutex_exit_all_but | ( | hash_table_t * | table, |
ib_mutex_t * | keep_mutex | ||
) |
Releases all but the passed in mutex of a hash table. in: mutex to keep
table | in: hash table |
UNIV_INLINE void hash_table_clear | ( | hash_table_t * | table | ) |
Clears a hash table so that all the cells become empty. in/out: hash table
Clears a hash table so that all the cells become empty.
table | in/out: hash table |
UNIV_INTERN void hash_table_free | ( | hash_table_t * | table | ) |
Frees a hash table. in, own: hash table
UNIV_INTERN void hash_unlock_s | ( | hash_table_t * | table, |
ulint | fold | ||
) |
unlock an s-lock for a fold value in a hash table. in: fold
table | in: hash table |
UNIV_INTERN void hash_unlock_x | ( | hash_table_t * | table, |
ulint | fold | ||
) |
unlock x-lock for a fold value in a hash table. in: fold
table | in: hash table |
UNIV_INTERN void hash_unlock_x_all | ( | hash_table_t * | table | ) |
Releases all the locks of a hash table, in an ascending order. in: hash table
UNIV_INTERN void hash_unlock_x_all_but | ( | hash_table_t * | table, |
rw_lock_t * | keep_lock | ||
) |
Releases all but passed in lock of a hash table, in: lock to keep
table | in: hash table |