You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.8 KiB

  1. /* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; version 2 of the License.
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License
  10. along with this program; if not, write to the Free Software Foundation,
  11. 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
  12. #ifndef PFS_SETUP_ACTOR_H
  13. #define PFS_SETUP_ACTOR_H
  14. /**
  15. @file storage/perfschema/pfs_setup_actor.h
  16. Performance schema setup actors (declarations).
  17. */
  18. #include "sql_string.h"
  19. #include "pfs_lock.h"
  20. #include "lf.h"
  21. struct PFS_global_param;
  22. /* WL#988 Roles Not implemented yet */
  23. #define ROLENAME_LENGTH 64
  24. /**
  25. @addtogroup Performance_schema_buffers
  26. @{
  27. */
  28. /** Hash key for @sa PFS_setup_actor. */
  29. struct PFS_setup_actor_key
  30. {
  31. /**
  32. Hash search key.
  33. This has to be a string for LF_HASH,
  34. the format is "<username><0x00><hostname><0x00><rolename><0x00>"
  35. */
  36. char m_hash_key[USERNAME_LENGTH + 1 + HOSTNAME_LENGTH + 1 + ROLENAME_LENGTH + 1];
  37. /** Length of @c m_hash_key. */
  38. uint m_key_length;
  39. };
  40. /** A setup_actor record. */
  41. struct PFS_ALIGNED PFS_setup_actor
  42. {
  43. /** Internal lock. */
  44. pfs_lock m_lock;
  45. /** Hash key. */
  46. PFS_setup_actor_key m_key;
  47. /** User name. This points inside the hash key. */
  48. const char *m_username;
  49. /** Length of @c m_username. */
  50. uint m_username_length;
  51. /** Host name. This points inside the hash key. */
  52. const char *m_hostname;
  53. /** Length of @c m_hostname. */
  54. uint m_hostname_length;
  55. /** Role name. This points inside the hash key. */
  56. const char *m_rolename;
  57. /** Length of @c m_rolename. */
  58. uint m_rolename_length;
  59. };
  60. int init_setup_actor(const PFS_global_param *param);
  61. void cleanup_setup_actor(void);
  62. int init_setup_actor_hash(void);
  63. void cleanup_setup_actor_hash(void);
  64. int insert_setup_actor(const String *user, const String *host, const String *role);
  65. int delete_setup_actor(const String *user, const String *host, const String *role);
  66. int reset_setup_actor(void);
  67. long setup_actor_count(void);
  68. void lookup_setup_actor(PFS_thread *thread,
  69. const char *user, uint user_length,
  70. const char *host, uint host_length,
  71. bool *enabled);
  72. /* For iterators and show status. */
  73. extern ulong setup_actor_max;
  74. /* Exposing the data directly, for iterators. */
  75. extern PFS_setup_actor *setup_actor_array;
  76. extern LF_HASH setup_actor_hash;
  77. /** @} */
  78. #endif