MySQL 9.6.0
Source Code Documentation
mysql_lock_free_hash_imp.h
Go to the documentation of this file.
1/* Copyright (c) 2020, 2025, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License, version 2.0,
5as published by the Free Software Foundation.
6
7This program is designed to work with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation. The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have either included with
13the program or referenced in the documentation.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License, version 2.0, for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef MYSQL_LOCK_FREE_HASH_IMP_H
25#define MYSQL_LOCK_FREE_HASH_IMP_H
26
29
30/**
31 An implementation of "mysql_lock_free_hash" component service using the
32 server's lock free hash implementation.
33*/
35 public:
36 /**
37 Wrapper around lf_hash_init2 function.
38
39 @see lf_hash_init2
40 */
42 (uint element_size, uint flags, uint key_offset,
43 uint key_length, hash_get_key_function get_key,
46
47 /**
48 Wrapper around lf_hash_destroy function.
49
50 @see lf_hash_destroy
51 */
52 static DEFINE_BOOL_METHOD(destroy, (LF_HASH_h hash));
53
54 /**
55 Wrapper around lf_hash_get_pins function.
56
57 @see lf_hash_get_pins
58 */
60
61 /**
62 Wrapper around lf_hash_search function.
63
64 @see lf_hash_search
65 */
66 static DEFINE_METHOD(void *, search,
67 (LF_HASH_h hash, LF_PINS_h pins, const void *data,
68 ulong length));
69
70 /**
71 Wrapper around lf_hash_delete function.
72
73 @see lf_hash_delete
74 */
75 static DEFINE_METHOD(int, remove,
76 (LF_HASH_h hash, LF_PINS_h pins, const void *data,
77 uint length));
78
79 /**
80 Wrapper around lf_hash_random_match function.
81
82 @see lf_hash_random_match
83 */
84 static DEFINE_METHOD(void *, random_match,
85 (LF_HASH_h hash, LF_PINS_h pins,
86 lf_hash_match_func *match, uint rand_val,
87 void *match_arg));
88
89 /**
90 Wrapper around lf_hash_search_unpin function.
91
92 @see lf_hash_search_unpin
93 */
94 static DEFINE_METHOD(void, search_unpin, (LF_PINS_h pins));
95
96 /**
97 Wrapper around lf_hash_put_pins function.
98
99 @see lf_hash_put_pins
100 */
101 static DEFINE_METHOD(void, put_pins, (LF_PINS_h pins));
102
103 /**
104 Wrapper around lf_hash_insert function.
105
106 @see lf_hash_insert
107 */
108 static DEFINE_METHOD(int, insert,
109 (LF_HASH_h hash, LF_PINS_h pins, const void *data));
110
111 /**
112 LF_HASH_OVERHEAD value.
113
114 @see LF_HASH_OVERHEAD
115 */
116 static DEFINE_METHOD(int, overhead, ());
117};
118
119#endif /* MYSQL_LOCK_FREE_HASH_IMP_H */
An implementation of "mysql_lock_free_hash" component service using the server's lock free hash imple...
Definition: mysql_lock_free_hash_imp.h:34
static mysql_service_status_t destroy(LF_HASH_h hash) noexcept
Wrapper around lf_hash_destroy function.
Definition: mysql_lock_free_hash_imp.cc:46
static LF_PINS_h get_pins(LF_HASH_h hash) noexcept
Wrapper around lf_hash_get_pins function.
Definition: mysql_lock_free_hash_imp.cc:57
static void put_pins(LF_PINS_h pins) noexcept
Wrapper around lf_hash_put_pins function.
Definition: mysql_lock_free_hash_imp.cc:88
static void * search(LF_HASH_h hash, LF_PINS_h pins, const void *data, ulong length) noexcept
Wrapper around lf_hash_search function.
Definition: mysql_lock_free_hash_imp.cc:63
static void * random_match(LF_HASH_h hash, LF_PINS_h pins, lf_hash_match_func *match, uint rand_val, void *match_arg) noexcept
Wrapper around lf_hash_random_match function.
Definition: mysql_lock_free_hash_imp.cc:76
static int overhead() noexcept
LF_HASH_OVERHEAD value.
Definition: mysql_lock_free_hash_imp.cc:98
static void search_unpin(LF_PINS_h pins) noexcept
Wrapper around lf_hash_search_unpin function.
Definition: mysql_lock_free_hash_imp.cc:83
static int insert(LF_HASH_h hash, LF_PINS_h pins, const void *data) noexcept
Wrapper around lf_hash_insert function.
Definition: mysql_lock_free_hash_imp.cc:93
static 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) noexcept
Wrapper around lf_hash_init2 function.
Definition: mysql_lock_free_hash_imp.cc:33
static int remove(LF_HASH_h hash, LF_PINS_h pins, const void *data, uint length) noexcept
Wrapper around lf_hash_delete function.
Definition: mysql_lock_free_hash_imp.cc:69
static int flags[50]
Definition: hp_test1.cc:40
void lf_hash_init_func(uchar *dst, const uchar *src)
Definition: lf_types.h:52
void lf_allocator_func(uchar *)
Definition: lf_types.h:48
const uchar *(* hash_get_key_function)(const uchar *arg, size_t *length)
Callback for extracting key and key length from user data in a LF_HASH.
Definition: lf_types.h:43
int lf_hash_match_func(const uchar *el, void *arg)
Definition: lf_types.h:50
struct LF_HASH_h_imp * LF_HASH_h
Hash colleciton handle.
Definition: mysql_lock_free_hash.h:34
struct LF_PINS_h_imp * LF_PINS_h
Hash collection access handle.
Definition: mysql_lock_free_hash.h:39
struct CHARSET_INFO_h_imp * CHARSET_INFO_h
Definition: mysql_string.h:41
const std::string charset("charset")
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
Specifies macros to define Service Implementations.
#define DEFINE_BOOL_METHOD(name, args)
A short macro to define method that returns bool, which is the most common case.
Definition: service_implementation.h:88
#define DEFINE_METHOD(retval, name, args)
A macro to ensure method implementation has required properties, that is it does not throw exceptions...
Definition: service_implementation.h:79