MySQL 9.4.0
Source Code Documentation
handler_db_object_table.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2021, 2025, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is designed to work with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24*/
25
26#ifndef ROUTER_SRC_REST_MRS_SRC_MRS_ENDPOINT_HANDLER_HANDLER_DB_OBJECT_TABLE_H_
27#define ROUTER_SRC_REST_MRS_SRC_MRS_ENDPOINT_HANDLER_HANDLER_DB_OBJECT_TABLE_H_
28
29#include <memory>
30#include <optional>
31#include <string>
32#include <vector>
33
41#include "mrs/gtid_manager.h"
42#include "mrs/rest/handler.h"
44
45namespace mrs {
46namespace endpoint {
47namespace handler {
48
50 public:
54 using DbObjectPtr = std::shared_ptr<DbObject>;
55 using DbSchemaPtr = std::shared_ptr<DbSchema>;
56 using DbServicePtr = std::shared_ptr<DbService>;
59 std::shared_ptr<mrs::ItemEndpointResponseCache>;
62 using PoolManagerRef = std::shared_ptr<PoolManager>;
63
64 public:
65 HandlerDbObjectTable(std::weak_ptr<DbObjectEndpoint> endpoint,
67 mrs::GtidManager *gtid_manager = nullptr,
68 collector::MysqlCacheManager *cache = nullptr,
69 mrs::ResponseCache *response_cache = nullptr,
70 mrs::database::SlowQueryMonitor *slow_monitor = nullptr);
71
73 UniversalId get_service_id() const override;
74 UniversalId get_db_object_id() const override;
75 UniversalId get_schema_id() const override;
76 const std::string &get_service_path() const override;
77 const std::string &get_db_object_path() const override;
78 const std::string &get_schema_path() const override;
79
80 void authorization(rest::RequestContext *ctxt) override;
81
84 const std::vector<uint8_t> &document) override;
87
88 uint32_t get_access_rights() const override;
89
90 protected:
95 PoolManagerRef *out_pool = nullptr);
96
97 uint64_t get_items_on_page() const;
100 std::shared_ptr<database::entry::Object> object) const;
101
102 uint64_t slow_query_timeout() const;
103
106 std::weak_ptr<DbObjectEndpoint> endpoint_;
113};
114
115} // namespace handler
116} // namespace endpoint
117} // namespace mrs
118
119#endif // ROUTER_SRC_REST_MRS_SRC_MRS_ENDPOINT_HANDLER_HANDLER_DB_OBJECT_TABLE_H_
Definition: cache_manager.h:41
Definition: mysql_cache_manager.h:87
MySqlCacheManager::CachedObject CachedObject
Definition: mysql_cache_manager.h:92
Definition: mysql_fixed_pool_manager.h:40
The handler class is the interface for dynamically loadable storage engines.
Definition: handler.h:4666
Definition: gtid_manager.h:50
Definition: response_cache.h:66
Definition: object_row_ownership.h:45
Definition: slow_query_monitor.h:47
Definition: db_object_endpoint.h:40
Definition: handler_db_object_table.h:49
HandlerDbObjectTable(std::weak_ptr< DbObjectEndpoint > endpoint, mrs::interface::AuthorizeManager *auth_manager, mrs::GtidManager *gtid_manager=nullptr, collector::MysqlCacheManager *cache=nullptr, mrs::ResponseCache *response_cache=nullptr, mrs::database::SlowQueryMonitor *slow_monitor=nullptr)
Definition: handler_db_object_table.cc:274
HttpResult handle_delete(rest::RequestContext *ctxt) override
Definition: handler_db_object_table.cc:561
std::shared_ptr< DbObject > DbObjectPtr
Definition: handler_db_object_table.h:54
uint32_t get_access_rights() const override
Definition: handler_db_object_table.cc:760
Authorization requires_authentication() const override
Definition: handler_db_object_table.cc:730
mrs::database::entry::DbObject DbObject
Definition: handler_db_object_table.h:51
void authorization(rest::RequestContext *ctxt) override
Definition: handler_db_object_table.cc:304
DbObjectPtr entry_
Definition: handler_db_object_table.h:107
std::weak_ptr< DbObjectEndpoint > endpoint_
Definition: handler_db_object_table.h:106
UniversalId get_schema_id() const override
Definition: handler_db_object_table.cc:740
EndpointResponseCachePtr response_cache_
Definition: handler_db_object_table.h:111
CachedSession get_session(rest::RequestContext *ctxt, collector::MySQLConnection type=collector::MySQLConnection::kMySQLConnectionUserdataRO, PoolManagerRef *out_pool=nullptr)
Definition: handler_db_object_table.cc:787
std::shared_ptr< mrs::ItemEndpointResponseCache > EndpointResponseCachePtr
Definition: handler_db_object_table.h:59
mrs::database::entry::DbService DbService
Definition: handler_db_object_table.h:53
HttpResult handle_put(rest::RequestContext *ctxt) override
Definition: handler_db_object_table.cc:657
UniversalId get_service_id() const override
Definition: handler_db_object_table.cc:736
uint64_t get_items_on_page() const
Definition: handler_db_object_table.cc:764
collector::MysqlCacheManager * cache_
Definition: handler_db_object_table.h:105
const std::string & get_service_path() const override
Definition: handler_db_object_table.cc:748
mrs::database::entry::RowUserOwnership ownership_
Definition: handler_db_object_table.h:110
mrs::database::SlowQueryMonitor * slow_monitor_
Definition: handler_db_object_table.h:112
HttpResult handle_post(rest::RequestContext *ctxt, const std::vector< uint8_t > &document) override
Post is insert.
Definition: handler_db_object_table.cc:485
const std::string & get_schema_path() const override
Definition: handler_db_object_table.cc:756
std::shared_ptr< PoolManager > PoolManagerRef
Definition: handler_db_object_table.h:62
const std::string & get_db_object_path() const override
Definition: handler_db_object_table.cc:752
uint64_t slow_query_timeout() const
Definition: handler_db_object_table.cc:308
DbSchemaPtr schema_entry_
Definition: handler_db_object_table.h:108
mrs::database::entry::DbSchema DbSchema
Definition: handler_db_object_table.h:52
mrs::GtidManager * gtid_manager_
Definition: handler_db_object_table.h:104
DbServicePtr service_entry_
Definition: handler_db_object_table.h:109
mrs::database::ObjectRowOwnership row_ownership_info(rest::RequestContext *ctxt, std::shared_ptr< database::entry::Object > object) const
Definition: handler_db_object_table.cc:773
std::shared_ptr< DbService > DbServicePtr
Definition: handler_db_object_table.h:56
std::shared_ptr< DbSchema > DbSchemaPtr
Definition: handler_db_object_table.h:55
UniversalId get_db_object_id() const override
Definition: handler_db_object_table.cc:744
HttpResult handle_get(rest::RequestContext *ctxt) override
Definition: handler_db_object_table.cc:315
Definition: authorize_manager.h:58
Authorization
Definition: rest_handler.h:148
Definition: handler.h:46
MySQLConnection
Definition: mysql_cache_manager.h:41
@ kMySQLConnectionUserdataRO
Definition: mysql_cache_manager.h:43
DbSchemaEndpoint::DbSchema DbSchema
Definition: db_schema_endpoint.cc:37
DbObjectEndpoint::DbObject DbObject
Definition: db_object_endpoint.cc:35
ContentFileEndpoint::UniversalId UniversalId
Definition: content_file_endpoint.cc:39
DbServiceEndpoint::DbService DbService
Definition: db_service_endpoint.cc:46
Definition: authorize_manager.h:48
required string type
Definition: replication_group_member_actions.proto:34
Definition: row_user_ownership.h:35
Definition: http_result.h:37
Definition: request_context.h:47