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