MySQL 8.0.40
Source Code Documentation
resource_group_impl.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_IMPL_INCLUDED
25#define DD__RESOURCE_GROUP_IMPL_INCLUDED
26
27#include <sys/types.h>
28#include <bitset>
29#include <new>
30#include <string>
31#include <vector>
32
34#include "sql/dd/impl/types/entity_object_impl.h" // dd::Entity_object_impl
36#include "sql/dd/object_id.h"
37#include "sql/dd/types/resource_group.h" // dd::Resource_group
38#include "sql/resourcegroups/resource_group_sql_cmd.h" // resourcegroups::Type
39
40namespace dd {
41
42class Open_dictionary_tables_ctx;
43class Weak_object;
44
46 public:
49
50 public:
51 const Object_table &object_table() const override;
53
54 bool validate() const override;
55 bool restore_attributes(const Raw_record &r) override;
56 bool store_attributes(Raw_record *r) override;
57 void debug_print(String_type &outb) const override;
58
59 const resourcegroups::Type &resource_group_type() const override {
60 return m_type;
61 }
63 m_type = type;
64 }
65
66 bool resource_group_enabled() const override { return m_enabled; }
67 void set_resource_group_enabled(bool enabled) override {
69 }
70
71 const std::bitset<CPU_MASK_SIZE> &cpu_id_mask() const override {
72 return m_cpu_id_mask;
73 }
74
76 const std::vector<resourcegroups::Range> &vcpu_vec) override {
77 m_cpu_id_mask.reset();
78 for (auto vcpu_range : vcpu_vec) {
79 for (auto bit_pos = vcpu_range.m_start; bit_pos <= vcpu_range.m_end;
80 ++bit_pos)
81 m_cpu_id_mask.set(bit_pos);
82 }
83 }
84
85 int thread_priority() const override { return m_thread_priority; }
86
87 void set_thread_priority(int priority) override {
89 }
90
91 // Fix "inherits ... via dominance" warnings
93 const Entity_object_impl *impl() const override {
95 }
96 Object_id id() const override { return Entity_object_impl::id(); }
97 bool is_persistent() const override {
99 }
100 const String_type &name() const override {
102 }
103 void set_name(const String_type &name) override {
105 }
106
107 private:
111 std::bitset<CPU_MASK_SIZE> m_cpu_id_mask;
113
114 Resource_group *clone() const override {
115 return new Resource_group_impl(*this);
116 }
117
119 // Play simple. Proper placeholder will take the same memory as clone.
120 return clone();
121 }
122};
123
124} // namespace dd
125#endif // DD__RESOURCE_GROUP_IMPL_INCLUDED
Definition: entity_object_impl.h:44
void set_name(const String_type &name) override
Definition: entity_object_impl.h:62
Object_id id() const override
The unique dictionary object id.
Definition: entity_object_impl.h:49
const String_type & name() const override
Definition: entity_object_impl.h:60
Entity_object_impl * impl() override
Definition: entity_object_impl.h:68
bool is_persistent() const override
Is dictionary object persistent in dictionary tables ?
Definition: entity_object_impl.h:57
This class represents all data dictionary table like mysql.tables, mysql.columns and more.
Definition: object_table.h:72
Auxiliary class for opening dictionary tables.
Definition: transaction_impl.h:76
Definition: raw_record.h:46
Definition: resource_group_impl.h:45
bool store_attributes(Raw_record *r) override
Definition: resource_group_impl.cc:90
const String_type & name() const override
Definition: resource_group_impl.h:100
Resource_group * clone() const override
Definition: resource_group_impl.h:114
int thread_priority() const override
Definition: resource_group_impl.h:85
const std::bitset< CPU_MASK_SIZE > & cpu_id_mask() const override
Definition: resource_group_impl.h:71
void set_resource_group_enabled(bool enabled) override
Definition: resource_group_impl.h:67
Resource_group_impl()
Definition: resource_group_impl.cc:38
int m_thread_priority
Definition: resource_group_impl.h:112
const Entity_object_impl * impl() const override
Definition: resource_group_impl.h:93
void set_name(const String_type &name) override
Definition: resource_group_impl.h:103
bool restore_attributes(const Raw_record &r) override
Definition: resource_group_impl.cc:67
bool m_enabled
Definition: resource_group_impl.h:110
const resourcegroups::Type & resource_group_type() const override
Definition: resource_group_impl.h:59
void set_cpu_id_mask(const std::vector< resourcegroups::Range > &vcpu_vec) override
Definition: resource_group_impl.h:75
Resource_group * clone_dropped_object_placeholder() const override
Allocate a new object which can serve as a placeholder for the original object in the Dictionary_clie...
Definition: resource_group_impl.h:118
Object_id id() const override
The unique dictionary object id.
Definition: resource_group_impl.h:96
bool resource_group_enabled() const override
Definition: resource_group_impl.h:66
Entity_object_impl * impl() override
Definition: resource_group_impl.h:92
String_type m_resource_group_name
Definition: resource_group_impl.h:108
const Object_table & object_table() const override
Definition: resource_group_impl.cc:112
void debug_print(String_type &outb) const override
Definition: resource_group_impl.cc:101
std::bitset< CPU_MASK_SIZE > m_cpu_id_mask
Definition: resource_group_impl.h:111
void set_resource_group_type(const resourcegroups::Type &type) override
Definition: resource_group_impl.h:62
bool validate() const override
Definition: resource_group_impl.cc:53
void set_thread_priority(int priority) override
Definition: resource_group_impl.h:87
bool is_persistent() const override
Is dictionary object persistent in dictionary tables ?
Definition: resource_group_impl.h:97
resourcegroups::Type m_type
Definition: resource_group_impl.h:109
static void register_tables(Open_dictionary_tables_ctx *otx)
Definition: resource_group_impl.cc:116
Definition: resource_group.h:49
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:43
unsigned long long Object_id
Definition: object_id.h:31
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:51
Type
Definition: resource_group_basic_types.h:33
const mysql_service_registry_t * r
Definition: pfs_example_plugin_employee.cc:86
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