MySQL 9.0.0
Source Code Documentation
mysql_thd_store_service.h
Go to the documentation of this file.
1/* Copyright (c) 2022, 2024, 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 COMPONENTS_SERVICES_MYSQL_THD_STORE_SERVICE_H
25#define COMPONENTS_SERVICES_MYSQL_THD_STORE_SERVICE_H
26
29
31
32/**
33 Callback to free resource stored in THD
34
35 returns 0 for success, 1 otherwise.
36*/
37typedef int (*free_resource_fn)(void *);
38
39/**
40 @file mysql/components/services/mysql_thd_store_service.h
41 Connection event tracking.
42*/
43
44/**
45 @ingroup event_tracking_services_inventory
46
47 A service to store an opaque pointer in MYSQL_THD
48*/
49
51
52/**
53 Register a slot to store data specific to a component
54
55 The free_resource callback is used to free the stored pointer
56 before thd is destroyed
57
58 @param [in] name Implementation name
59 @param [in] free_fn Callback to free resource stored in the slot
60 @param [out] slot Key used to identify the object handle
61
62 @returns status of registration
63 @retval false Success
64 @retval true Error. This typically means all slots are full
65*/
66DECLARE_BOOL_METHOD(register_slot, (const char *name, free_resource_fn free_fn,
68
69/**
70 Unregister a slot
71
72 @param [in, out] slot Key allocated to component
73
74 @returns status of operation
75 @retval false Success
76 @retval true Error
77*/
79
80/**
81 Set/Reset an opaque pointer in thd store.
82
83 @param [in] thd Session handle. If NULL, current session will be
84 used.
85 @param [in] slot Key used to identify the object handle
86 @param [in] object Handle of the object being stored. If NULL, it will
87 be considered removal.
88
89 @returns Status of the operation
90 @retval false Success
91 @retval true Error
92*/
94 (MYSQL_THD thd, mysql_thd_store_slot slot, void *object));
95
96/**
97 Get handle to an already stored object
98
99 @param [in] thd Session handle. If NULL, current session will be used.
100 @param [in] slot Key used to identify the object handle
101
102 @returns handle to the object if found, nullptr otherwise
103*/
105
107
108#endif // !COMPONENTS_SERVICES_MYSQL_THD_STORE_SERVICE_H
#define MYSQL_THD
Definition: backup_page_tracker.h:38
int(* free_resource_fn)(void *)
Callback to free resource stored in THD.
Definition: mysql_thd_store_service.h:37
struct mysql_thd_store_slot_imp * mysql_thd_store_slot
Definition: mysql_thd_store_service.h:30
static mysql_service_status_t get(THD **thd) noexcept
Definition: mysql_current_thread_reader_all_empty.cc:31
std::set< Key, Compare, ut::allocator< Key > > set
Specialization of set which uses ut_allocator.
Definition: ut0new.h:2883
#define DECLARE_METHOD(retval, name, args)
Declares a method as a part of the Service definition.
Definition: service.h:103
#define END_SERVICE_DEFINITION(name)
A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro.
Definition: service.h:91
#define BEGIN_SERVICE_DEFINITION(name)
Declares a new Service.
Definition: service.h:86
#define DEFINE_SERVICE_HANDLE(name)
Defines an object type that is meant for carrying handles to the implementation-specific objects used...
Definition: service.h:129
#define DECLARE_BOOL_METHOD(name, args)
Declares a method that returns bool as a part of the Service definition.
Definition: service.h:112
case opt name
Definition: sslopt-case.h:29