MySQL 9.0.0
Source Code Documentation
resource_group.h
Go to the documentation of this file.
1/* Copyright (c) 2014, 2024, 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 DD__RESOURCE_GROUP_INCLUDED
25#define DD__RESOURCE_GROUP_INCLUDED
26
27#include <bitset> // std::bitset
28#include <memory> // std::unique_ptr
29
30#include "sql/dd/types/entity_object.h" // dd::Entity_object
31#include "sql/dd/types/entity_object_table.h" // dd::Entity_object_table
33
34struct MDL_key;
35
36namespace dd {
37
38class Object_type;
39class Primary_id_key;
40class Resource_group_impl;
41class Global_name_key;
42class Void_key;
43
44namespace tables {
45class Resource_groups;
46}
47
48static constexpr int CPU_MASK_SIZE = 1024;
49class Resource_group : virtual public Entity_object {
50 public:
57
58 public:
59 ~Resource_group() override = default;
60
61 virtual bool update_id_key(Id_key *key) const {
62 return update_id_key(key, id());
63 }
64 static bool update_id_key(Id_key *key, Object_id id);
65
66 virtual bool update_name_key(Name_key *key) const {
67 return update_name_key(key, name());
68 }
69 static bool update_name_key(Name_key *key, const String_type &name);
70
71 virtual bool update_aux_key(Aux_key *) const { return true; }
72
73 virtual const resourcegroups::Type &resource_group_type() const = 0;
75
76 virtual bool resource_group_enabled() const = 0;
77 virtual void set_resource_group_enabled(bool enabled) = 0;
78
79 virtual const std::bitset<CPU_MASK_SIZE> &cpu_id_mask() const = 0;
80 virtual void set_cpu_id_mask(
81 const std::vector<resourcegroups::Range> &vcpu_vec) = 0;
82
83 virtual int thread_priority() const = 0;
84 virtual void set_thread_priority(int priority) = 0;
85
86 virtual Resource_group *clone() const = 0;
87
88 /**
89 Allocate a new object which can serve as a placeholder for the original
90 object in the Dictionary_client's dropped registry (i.e. it has the same
91 keys as original).
92 */
94
95 static void create_mdl_key(const String_type &name, MDL_key *key);
96};
97} // namespace dd
98
99#endif // DD__RESOURCE_GROUP_INCLUDED
Base class for dictionary objects which has single column integer primary key.
Definition: entity_object.h:48
virtual const String_type & name() const =0
Definition: object_keys.h:123
Definition: object_keys.h:77
Definition: resource_group_impl.h:45
Definition: resource_group.h:49
virtual Resource_group * clone() const =0
virtual void set_resource_group_enabled(bool enabled)=0
Void_key Aux_key
Definition: resource_group.h:56
virtual int thread_priority() const =0
virtual bool update_aux_key(Aux_key *) const
Definition: resource_group.h:71
virtual const resourcegroups::Type & resource_group_type() const =0
tables::Resource_groups DD_table
Definition: resource_group.h:53
static void create_mdl_key(const String_type &name, MDL_key *key)
Definition: resource_group_impl.cc:138
virtual bool update_name_key(Name_key *key) const
Definition: resource_group.h:66
Global_name_key Name_key
Definition: resource_group.h:55
virtual void set_cpu_id_mask(const std::vector< resourcegroups::Range > &vcpu_vec)=0
virtual void set_resource_group_type(const resourcegroups::Type &type)=0
~Resource_group() override=default
virtual Resource_group * clone_dropped_object_placeholder() const =0
Allocate a new object which can serve as a placeholder for the original object in the Dictionary_clie...
Resource_group Cache_partition
Definition: resource_group.h:52
Resource_group_impl Impl
Definition: resource_group.h:51
virtual const std::bitset< CPU_MASK_SIZE > & cpu_id_mask() const =0
virtual bool update_id_key(Id_key *key) const
Definition: resource_group.h:61
virtual void set_thread_priority(int priority)=0
virtual bool resource_group_enabled() const =0
Primary_id_key Id_key
Definition: resource_group.h:54
Definition: object_keys.h:54
Definition: resource_groups.h:42
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:43
unsigned long long Object_id
Definition: object_id.h:31
static constexpr int CPU_MASK_SIZE
Definition: resource_group.h:48
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:51
Type
Definition: resource_group_basic_types.h:33
required string key
Definition: replication_asynchronous_connection_failover.proto:60
required uint32 priority
Definition: replication_group_member_actions.proto:35
required string type
Definition: replication_group_member_actions.proto:34
required bool enabled
Definition: replication_group_member_actions.proto:33
Metadata lock object key.
Definition: mdl.h:365