MySQL 9.6.0
Source Code Documentation
s_mysql_mysql_lock_free_hash Struct Reference

Lock free hashing collection. More...

#include <mysql_lock_free_hash.h>

Public Attributes

LF_HASH_h(* init )(uint element_size, uint flags, uint key_offset, uint key_length, hash_get_key_function get_key, CHARSET_INFO_h charset, lf_allocator_func *ctor, lf_allocator_func *dtor, lf_hash_init_func *init)
 Initialize lock free hash. More...
 
mysql_service_status_t(* destroy )(LF_HASH_h hash)
 Destroy lock free hash. More...
 
LF_PINS_h(* get_pins )(LF_HASH_h hash)
 Get pins for search. More...
 
void *(* search )(LF_HASH_h hash, LF_PINS_h pins, const void *data, ulong length)
 Find hash element corresponding to the key. More...
 
int(* remove )(LF_HASH_h hash, LF_PINS_h pins, const void *data, uint length)
 Remove data from hash. More...
 
void *(* random_match )(LF_HASH_h hash, LF_PINS_h pins, lf_hash_match_func *match, uint rand_val, void *match_arg)
 Find random hash element which satisfies condition specified by match function. More...
 
void(* search_unpin )(LF_PINS_h pins)
 Unpin search pins. More...
 
void(* put_pins )(LF_PINS_h pins)
 Put pins into a hash. More...
 
int(* insert )(LF_HASH_h hash, LF_PINS_h pins, const void *data)
 Insert data into a hash. More...
 
int(* overhead )()
 Hash entry header size. More...
 

Detailed Description

Lock free hashing collection.

Member Data Documentation

◆ destroy

mysql_service_status_t(* s_mysql_mysql_lock_free_hash::destroy) (LF_HASH_h hash)

Destroy lock free hash.

Parameters
hashHash handle.

◆ get_pins

LF_PINS_h(* s_mysql_mysql_lock_free_hash::get_pins) (LF_HASH_h hash)

Get pins for search.

Parameters
hashHash handle.
Returns
Search pins handle.

◆ init

LF_HASH_h(* s_mysql_mysql_lock_free_hash::init) (uint element_size, uint flags, uint key_offset, uint key_length, hash_get_key_function get_key, CHARSET_INFO_h charset, lf_allocator_func *ctor, lf_allocator_func *dtor, lf_hash_init_func *init)

Initialize lock free hash.

Returns
Initialized hash handle.

◆ insert

int(* s_mysql_mysql_lock_free_hash::insert) (LF_HASH_h hash, LF_PINS_h pins, const void *data)

Insert data into a hash.

Parameters
hashHash handle.
pinsPins handle.
dataData pointer.
Return values
0Inserted.
1Failed. Unique key conflict.
-1Failed. Out of memory.

◆ overhead

int(* s_mysql_mysql_lock_free_hash::overhead) ()

Hash entry header size.

Returns
Overhead value.

◆ put_pins

void(* s_mysql_mysql_lock_free_hash::put_pins) (LF_PINS_h pins)

Put pins into a hash.

Parameters
pinsPins handle.

◆ random_match

void *(* s_mysql_mysql_lock_free_hash::random_match) (LF_HASH_h hash, LF_PINS_h pins, lf_hash_match_func *match, uint rand_val, void *match_arg)

Find random hash element which satisfies condition specified by match function.

Parameters
hashHash to search element in.
pinsPins for calling thread to be used during search and for pinning its result.
matchPointer 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_valRandom value to be used for selecting hash bucket from which search in sort-ordered list needs to be started.
match_argArgument passed to match function.
Return values
Apointer to a random element matching condition.
NULL- if nothing is found
MY_LF_ERRPTR- OOM.
Note
This function follows the same pinning protocol as lf_hash_search(), i.e. uses pins[0..2]. On return pins[0..1] are removed and pins[2] is used to pin object found. It is also not removed in case when object is not found/error occurs but its value is undefined in this case. So calling lf_hash_unpin() is mandatory after call to this function in case of both success and failure.

◆ remove

int(* s_mysql_mysql_lock_free_hash::remove) (LF_HASH_h hash, LF_PINS_h pins, const void *data, uint length)

Remove data from hash.

Parameters
hashHash handle.
pinsSearch pins.
dataSearch data.
lengthData length.
Returns
Zero value on success.

◆ search

void *(* s_mysql_mysql_lock_free_hash::search) (LF_HASH_h hash, LF_PINS_h pins, const void *data, ulong length)

Find hash element corresponding to the key.

Parameters
hashThe hash to search element in.
pinsPins for the calling thread which were earlier obtained from this hash using lf_hash_get_pins().
datKey
lengthKey length
Return values
Apointer 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
Note
Uses pins[0..2]. On return pins[0..1] are removed and pins[2] is used to pin object found. It is also not removed in case when object is not found/error occurs but pin value is undefined in this case. So calling search_unpin() is mandatory after call to this function in case of both success and failure.

◆ search_unpin

void(* s_mysql_mysql_lock_free_hash::search_unpin) (LF_PINS_h pins)

Unpin search pins.

Parameters
pinsPins handle.

The documentation for this struct was generated from the following file: