Lock free hashing collection.
More...
#include <mysql_lock_free_hash.h>
|
| 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...
|
| |
Lock free hashing collection.
◆ destroy
Destroy lock free hash.
- Parameters
-
◆ get_pins
Get pins for search.
- Parameters
-
- Returns
- Search pins handle.
◆ 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
-
| hash | Hash handle. |
| pins | Pins handle. |
| data | Data pointer. |
- Return values
-
| 0 | Inserted. |
| 1 | Failed. Unique key conflict. |
| -1 | Failed. 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
-
◆ random_match
Find random hash element which satisfies condition specified by match function.
- Parameters
-
| 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. |
- Return values
-
| A | pointer 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
-
| hash | Hash handle. |
| pins | Search pins. |
| data | Search data. |
| length | Data 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
-
| 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(). |
| dat | Key |
| length | Key length |
- Return values
-
| 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 |
- 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
-
The documentation for this struct was generated from the following file: