MySQL  8.0.20
Source Code Documentation
pfs_setup_actor.h
Go to the documentation of this file.
1 /* Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved.
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 also distributed 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 included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef PFS_SETUP_ACTOR_H
24 #define PFS_SETUP_ACTOR_H
25 
26 /**
27  @file storage/perfschema/pfs_setup_actor.h
28  Performance schema setup actors (declarations).
29 */
30 
31 #include <sys/types.h>
32 
33 #include "lf.h"
34 #include "my_hostname.h" /* HOSTNAME_LENGTH */
35 #include "mysql_com.h"
36 #include "sql_string.h"
39 
40 struct PFS_global_param;
41 struct PFS_thread;
42 class PFS_opaque_container_page;
43 
44 /* WL#988 Roles Not implemented yet */
45 #define ROLENAME_LENGTH 64
46 
47 /**
48  @addtogroup performance_schema_buffers
49  @{
50 */
51 
52 /** Hash key for @sa PFS_setup_actor. */
54  /**
55  Hash search key.
56  This has to be a string for @c LF_HASH,
57  the format is @c "<username><0x00><hostname><0x00><rolename><0x00>"
58  */
60  1];
61  /** Length of @c m_hash_key. */
63 };
64 
65 /** A setup_actor record. */
67  /** Internal lock. */
69  /** Hash key. */
71  /** User name. This points inside the hash key. */
72  const char *m_username;
73  /** Length of @c m_username. */
75  /** Host name. This points inside the hash key. */
76  const char *m_hostname;
77  /** Length of @c m_hostname. */
79  /** Role name. This points inside the hash key. */
80  const char *m_rolename;
81  /** Length of @c m_rolename. */
83  /** ENABLED flag. */
84  bool m_enabled;
85  /** HISTORY flag. */
86  bool m_history;
87  /** Container page. */
88  PFS_opaque_container_page *m_page;
89 };
90 
91 int init_setup_actor(const PFS_global_param *param);
92 void cleanup_setup_actor(void);
93 int init_setup_actor_hash(const PFS_global_param *param);
94 void cleanup_setup_actor_hash(void);
95 
96 int insert_setup_actor(const String *user, const String *host,
97  const String *role, bool enabled, bool history);
98 int delete_setup_actor(const String *user, const String *host,
99  const String *role);
100 int reset_setup_actor(void);
101 long setup_actor_count(void);
102 
103 void lookup_setup_actor(PFS_thread *thread, const char *user, uint user_length,
104  const char *host, uint host_length, bool *enabled,
105  bool *history);
106 
107 /** Update derived flags for all setup_actors. */
109 
110 /* For show status. */
111 
113 
114 /** @} */
115 #endif
int init_setup_actor(const PFS_global_param *param)
Initialize the setup actor buffers.
Definition: pfs_setup_actor.cc:57
A setup_actor record.
Definition: pfs_setup_actor.h:66
#define USERNAME_LENGTH
Definition: mysql_com.h:69
Our own string classes, used pervasively throughout the executor.
char * user
Definition: mysqladmin.cc:59
const char * m_username
User name.
Definition: pfs_setup_actor.h:72
const char * host
Definition: mysqladmin.cc:58
Performance schema internal locks (declarations).
LF_HASH setup_actor_hash
Hash table for setup_actor records.
Definition: pfs_setup_actor.cc:48
bool enabled
true if enabled.
Definition: buf0dblwr.cc:81
PFS_setup_actor_key m_key
Hash key.
Definition: pfs_setup_actor.h:70
pfs_lock m_lock
Internal lock.
Definition: pfs_setup_actor.h:68
Miscellaneous global dependencies (declarations).
const char * m_hostname
Host name.
Definition: pfs_setup_actor.h:76
Common definition used by mysys, performance schema and server & client.
Using this class is fraught with peril, and you need to be very careful when doing so...
Definition: sql_string.h:164
Hash key for.
Definition: pfs_setup_actor.h:53
Common definition between mysql server & client.
int update_setup_actors_derived_flags()
Update derived flags for all setup_actors.
Definition: pfs_setup_actor.cc:306
#define PFS_ALIGNED
Definition: pfs_global.h:54
unsigned int uint
Definition: uca-dump.cc:29
uint m_key_length
Length of m_hash_key.
Definition: pfs_setup_actor.h:62
static constexpr int HOSTNAME_LENGTH
Definition: my_hostname.h:42
bool m_enabled
ENABLED flag.
Definition: pfs_setup_actor.h:84
uint m_username_length
Length of m_username.
Definition: pfs_setup_actor.h:74
PFS_opaque_container_page * m_page
Container page.
Definition: pfs_setup_actor.h:88
Definition: lf.h:181
int init_setup_actor_hash(const PFS_global_param *param)
Initialize the setup actor hash.
Definition: pfs_setup_actor.cc:82
#define ROLENAME_LENGTH
Definition: pfs_setup_actor.h:45
A &#39;lock&#39; protecting performance schema internal buffers.
Definition: pfs_lock.h:152
char m_hash_key[USERNAME_LENGTH+1+HOSTNAME_LENGTH+1+ROLENAME_LENGTH+1]
Hash search key.
Definition: pfs_setup_actor.h:60
uint m_hostname_length
Length of m_hostname.
Definition: pfs_setup_actor.h:78
int reset_setup_actor()
Definition: pfs_setup_actor.cc:228
int delete_setup_actor(const String *user, const String *host, const String *role)
Definition: pfs_setup_actor.cc:180
const char * m_rolename
Role name.
Definition: pfs_setup_actor.h:80
void cleanup_setup_actor(void)
Cleanup all the setup actor buffers.
Definition: pfs_setup_actor.cc:62
bool m_history
HISTORY flag.
Definition: pfs_setup_actor.h:86
void cleanup_setup_actor_hash(void)
Cleanup the setup actor hash.
Definition: pfs_setup_actor.cc:93
uint m_rolename_length
Length of m_rolename.
Definition: pfs_setup_actor.h:82
int insert_setup_actor(const String *user, const String *host, const String *role, bool enabled, bool history)
Definition: pfs_setup_actor.cc:133
long setup_actor_count()
Definition: pfs_setup_actor.cc:248
Instrumented thread implementation.
Definition: pfs_instr.h:341
Performance schema global sizing parameters.
Definition: pfs_server.h:111
void lookup_setup_actor(PFS_thread *thread, const char *user, uint user_length, const char *host, uint host_length, bool *enabled, bool *history)
Definition: pfs_setup_actor.cc:255