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