MySQL 8.3.0
Source Code Documentation
mysql_thd_store_service.h
Go to the documentation of this file.
1/* Copyright (c) 2022, 2023, 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 also distributed 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 included with MySQL.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License, version 2.0, for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef COMPONENTS_SERVICES_MYSQL_THD_STORE_SERVICE_H
24#define COMPONENTS_SERVICES_MYSQL_THD_STORE_SERVICE_H
25
28
30
31/**
32 Callback to free resource stored in THD
33
34 returns 0 for success, 1 otherwise.
35*/
36typedef int (*free_resource_fn)(void *);
37
38/**
39 @file mysql/components/services/mysql_thd_store_service.h
40 Connection event tracking.
41*/
42
43/**
44 @ingroup event_tracking_services_inventory
45
46 A service to store an opaque pointer in MYSQL_THD
47*/
48
50
51/**
52 Register a slot to store data specific to a component
53
54 The free_resource callback is used to free the stored pointer
55 before thd is destroyed
56
57 @param [in] name Implementation name
58 @param [in] free_fn Callback to free resource stored in the slot
59 @param [out] slot Key used to identify the object handle
60
61 @returns status of registration
62 @retval false Success
63 @retval true Error. This typically means all slots are full
64*/
65DECLARE_BOOL_METHOD(register_slot, (const char *name, free_resource_fn free_fn,
67
68/**
69 Unregister a slot
70
71 @param [in, out] slot Key allocated to component
72
73 @returns status of operation
74 @retval false Success
75 @retval true Error
76*/
78
79/**
80 Set/Reset an opaque pointer in thd store.
81
82 @param [in] thd Session handle. If NULL, current session will be
83 used.
84 @param [in] slot Key used to identify the object handle
85 @param [in] object Handle of the object being stored. If NULL, it will
86 be considered removal.
87
88 @returns Status of the operation
89 @retval false Success
90 @retval true Error
91*/
93 (MYSQL_THD thd, mysql_thd_store_slot slot, void *object));
94
95/**
96 Get handle to an already stored object
97
98 @param [in] thd Session handle. If NULL, current session will be used.
99 @param [in] slot Key used to identify the object handle
100
101 @returns handle to the object if found, nullptr otherwise
102*/
104
106
107#endif // !COMPONENTS_SERVICES_MYSQL_THD_STORE_SERVICE_H
#define MYSQL_THD
Definition: backup_page_tracker.h:37
int(* free_resource_fn)(void *)
Callback to free resource stored in THD.
Definition: mysql_thd_store_service.h:36
struct mysql_thd_store_slot_imp * mysql_thd_store_slot
Definition: mysql_thd_store_service.h:29
void get(PSI_field *, PSI_longlong *) noexcept
Definition: pfs_plugin_column_bigint_v1_all_empty.cc:31
std::set< Key, Compare, ut::allocator< Key > > set
Specialization of set which uses ut_allocator.
Definition: ut0new.h:2881
#define DECLARE_METHOD(retval, name, args)
Declares a method as a part of the Service definition.
Definition: service.h:102
#define END_SERVICE_DEFINITION(name)
A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro.
Definition: service.h:90
#define BEGIN_SERVICE_DEFINITION(name)
Declares a new Service.
Definition: service.h:85
#define DEFINE_SERVICE_HANDLE(name)
Defines an object type that is meant for carrying handles to the implementation-specific objects used...
Definition: service.h:128
#define DECLARE_BOOL_METHOD(name, args)
Declares a method that returns bool as a part of the Service definition.
Definition: service.h:111
case opt name
Definition: sslopt-case.h:32