![]() |
MySQL 8.0.43
Source Code Documentation
|
extensible hash More...
#include <assert.h>#include <stddef.h>#include <string.h>#include <sys/types.h>#include <atomic>#include "lf.h"#include "m_ctype.h"#include "my_atomic.h"#include "my_bit.h"#include "my_compiler.h"#include "my_inttypes.h"#include "my_sys.h"#include "mysql/service_mysql_alloc.h"#include "mysys/mysys_priv.h"#include "template_utils.h"Classes | |
| struct | LF_SLIST |
| struct | CURSOR |
Macros | |
| #define | MAX_LOAD 1.0 /* average number of elements in a bucket */ |
Functions | |
| template<class T > | |
| static T * | PTR (T *ptr) |
| template<class T > | |
| static bool | DELETED (T *ptr) |
| template<class T > | |
| static T * | SET_DELETED (T *ptr) |
| static int | my_lfind (std::atomic< LF_SLIST * > *head, lf_cmp_func *cmp_func, CHARSET_INFO *cs, uint32 hashnr, const uchar *key, size_t keylen, CURSOR *cursor, LF_PINS *pins) |
| static int | my_lfind_match (std::atomic< LF_SLIST * > *head, uint32 first_hashnr, uint32 last_hashnr, lf_hash_match_func *match, CURSOR *cursor, LF_PINS *pins, void *match_arg) |
| Search for list element satisfying condition specified by match function and position cursor on it. More... | |
| static LF_SLIST * | linsert (std::atomic< LF_SLIST * > *head, lf_cmp_func *cmp_func, CHARSET_INFO *cs, LF_SLIST *node, LF_PINS *pins, uint flags) |
| static int | ldelete (std::atomic< LF_SLIST * > *head, lf_cmp_func *cmp_func, CHARSET_INFO *cs, uint32 hashnr, const uchar *key, uint keylen, LF_PINS *pins) |
| static LF_SLIST * | my_lsearch (std::atomic< LF_SLIST * > *head, lf_cmp_func *cmp_func, CHARSET_INFO *cs, uint32 hashnr, const uchar *key, uint keylen, LF_PINS *pins) |
| static const uchar * | hash_key (const LF_HASH *hash, const uchar *record, size_t *length) |
| static uint | calc_hash (LF_HASH *hash, const uchar *key, size_t keylen) |
| static int | initialize_bucket (LF_HASH *, std::atomic< LF_SLIST * > *, uint, LF_PINS *) |
| static uint | cset_hash_sort_adapter (const LF_HASH *hash, const uchar *key, size_t length) |
| Adaptor function which allows to use hash function from character set with LF_HASH. More... | |
| void | lf_hash_init_impl (LF_HASH *hash, uint element_size, uint flags, uint key_offset, uint key_length, hash_get_key_function get_key, CHARSET_INFO *charset, lf_hash_func *hash_function, lf_cmp_func *cmp_function, lf_allocator_func *ctor, lf_allocator_func *dtor, lf_hash_init_func *init) |
| void | lf_hash_init2 (LF_HASH *hash, uint element_size, uint flags, uint key_offset, uint key_length, hash_get_key_function get_key, CHARSET_INFO *charset, lf_hash_func *hash_function, lf_allocator_func *ctor, lf_allocator_func *dtor, lf_hash_init_func *init) |
| void | lf_hash_init3 (LF_HASH *hash, uint element_size, uint flags, hash_get_key_function get_key, lf_hash_func *hash_function, lf_cmp_func *cmp_function, lf_allocator_func *ctor, lf_allocator_func *dtor, lf_hash_init_func *init) |
| void | lf_hash_destroy (LF_HASH *hash) |
| int | lf_hash_insert (LF_HASH *hash, LF_PINS *pins, const void *data) |
| int | lf_hash_delete (LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen) |
| void * | lf_hash_search (LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen) |
| Find hash element corresponding to the key. More... | |
| void * | lf_hash_random_match (LF_HASH *hash, LF_PINS *pins, lf_hash_match_func *match, uint rand_val, void *match_arg) |
| Find random hash element which satisfies condition specified by match function. More... | |
Variables | |
| const int | LF_HASH_OVERHEAD = sizeof(LF_SLIST) |
| static const uchar * | dummy_key = pointer_cast<const uchar *>("") |
extensible hash
| #define MAX_LOAD 1.0 /* average number of elements in a bucket */ |
|
static |
Adaptor function which allows to use hash function from character set with LF_HASH.
|
inlinestatic |
|
inlinestatic |
|
static |
|
static |
| void lf_hash_destroy | ( | LF_HASH * | hash | ) |
| void lf_hash_init2 | ( | LF_HASH * | hash, |
| uint | element_size, | ||
| uint | flags, | ||
| uint | key_offset, | ||
| uint | key_length, | ||
| hash_get_key_function | get_key, | ||
| CHARSET_INFO * | charset, | ||
| lf_hash_func * | hash_function, | ||
| lf_allocator_func * | ctor, | ||
| lf_allocator_func * | dtor, | ||
| lf_hash_init_func * | init | ||
| ) |
| void lf_hash_init3 | ( | LF_HASH * | hash, |
| uint | element_size, | ||
| uint | flags, | ||
| hash_get_key_function | get_key, | ||
| lf_hash_func * | hash_function, | ||
| lf_cmp_func * | cmp_function, | ||
| lf_allocator_func * | ctor, | ||
| lf_allocator_func * | dtor, | ||
| lf_hash_init_func * | init | ||
| ) |
| void lf_hash_init_impl | ( | LF_HASH * | hash, |
| uint | element_size, | ||
| uint | flags, | ||
| uint | key_offset, | ||
| uint | key_length, | ||
| hash_get_key_function | get_key, | ||
| CHARSET_INFO * | charset, | ||
| lf_hash_func * | hash_function, | ||
| lf_cmp_func * | cmp_function, | ||
| lf_allocator_func * | ctor, | ||
| lf_allocator_func * | dtor, | ||
| lf_hash_init_func * | init | ||
| ) |
| void * lf_hash_random_match | ( | LF_HASH * | hash, |
| LF_PINS * | pins, | ||
| lf_hash_match_func * | match, | ||
| uint | rand_val, | ||
| void * | match_arg | ||
| ) |
Find random hash element which satisfies condition specified by match function.
| hash | Hash to search element in. |
| pins | Pins for calling thread to be used during search and for pinning its result. |
| match | Pointer to match function. This function takes pointer to object stored in hash as parameter and returns 0 if object doesn't satisfy its condition (and non-0 value if it does). |
| rand_val | Random value to be used for selecting hash bucket from which search in sort-ordered list needs to be started. |
| match_arg | Argument passed to match function. |
| A | pointer to a random element matching condition. |
| NULL | - if nothing is found |
| MY_LF_ERRPTR | - OOM. |
Find hash element corresponding to the key.
| hash | The hash to search element in. |
| pins | Pins for the calling thread which were earlier obtained from this hash using lf_hash_get_pins(). |
| key | Key |
| keylen | Key length |
| A | pointer to an element with the given key (if a hash is not unique and there're many elements with this key - the "first" matching element). |
| NULL | - if nothing is found |
| MY_LF_ERRPTR | - if OOM |
|
static |
|
static |
|
static |
Search for list element satisfying condition specified by match function and position cursor on it.
| head | Head of the list to search in. |
| first_hashnr | Hash value to start search from. |
| last_hashnr | Hash value to stop search after. |
| match | Match function. |
| cursor | Cursor to be position. |
| pins | LF_PINS for the calling thread to be used during search for pinning result. |
| match_arg | Argument passed to match function. |
| 0 | - not found |
| 1 | - found |
|
static |
|
inlinestatic |
|
inlinestatic |
|
static |
| const int LF_HASH_OVERHEAD = sizeof(LF_SLIST) |