MySQL 9.3.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
connection_control_pfs_table.h
Go to the documentation of this file.
1/* Copyright (c) 2024, 2025, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef CONNECTION_CONTROL_PFS_TABLE_H
25#define CONNECTION_CONTROL_PFS_TABLE_H
26
28#include <limits>
29#include <memory>
30#include <string>
31#include <vector>
33
34namespace connection_control {
37
38template <typename T>
40 public:
41 using value_type = T;
42
43 CustomAllocator() = default;
44
45 template <typename U>
47
48 // Allocate memory
49 T *allocate(std::size_t n) {
50 if (n > std::numeric_limits<std::size_t>::max() / sizeof(T)) {
51 throw std::bad_alloc();
52 }
53 // Use ::operator new with proper alignment for T
54 T *temp = static_cast<T *>(operator new(n * sizeof(T)));
55 if (temp == nullptr) throw std::bad_alloc();
56 return temp;
57 }
58
59 // Deallocate memory
60 void deallocate(T *ptr, std::size_t) {
61 // Use ::operator delete with alignment
62 operator delete(ptr);
63 }
64};
65
66// Stores row data for
67// performance_schema.connection_control_failed_login_attempts table
69 public:
70 // Constructor taking parameters
71 Connection_control_pfs_table_data_row(const std::string &userhost,
72 const PSI_ulong &failed_attempts);
73 std::string m_userhost;
75};
76
80
81} // namespace connection_control
82
83#endif /* CONNECTION_CONTROL_PFS_TABLE_H */
Definition: connection_control_memory.h:41
Definition: connection_control_pfs_table.h:68
PSI_ulong m_failed_attempts
Definition: connection_control_pfs_table.h:74
Connection_control_pfs_table_data_row(const std::string &userhost, const PSI_ulong &failed_attempts)
Definition: connection_control_pfs_table.cc:36
std::string m_userhost
Definition: connection_control_pfs_table.h:73
Definition: connection_control_pfs_table.h:39
CustomAllocator(const CustomAllocator< U > &)
Definition: connection_control_pfs_table.h:46
T * allocate(std::size_t n)
Definition: connection_control_pfs_table.h:49
T value_type
Definition: connection_control_pfs_table.h:41
void deallocate(T *ptr, std::size_t)
Definition: connection_control_pfs_table.h:60
#define T
Definition: jit_executor_value.cc:373
Definition: connection_control.h:70
bool unregister_pfs_table()
Definition: connection_control_pfs_table.cc:213
std::vector< Connection_control_pfs_table_data_row, CustomAllocator< Connection_control_pfs_table_data_row > > Connection_control_pfs_table_data
Definition: connection_control_pfs_table.h:79
bool register_pfs_table()
Definition: connection_control_pfs_table.cc:179
ValueType max(X &&first)
Definition: gtid.h:103
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2876
Definition: pfs_plugin_table_service.h:118
int n
Definition: xcom_base.cc:509