MySQL 9.3.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
db_service_file_system.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024, 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, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
19 * the GNU General Public License, version 2.0, 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 Foundation, Inc.,
23 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
26#ifndef ROUTER_SRC_MYSQL_REST_SERVICE_SRC_MRS_FILE_SYSTEM_FILE_SYSTEM_H_
27#define ROUTER_SRC_MYSQL_REST_SERVICE_SRC_MRS_FILE_SYSTEM_FILE_SYSTEM_H_
28
29#include <map>
30#include <memory>
31#include <string>
32
36
37namespace mrs {
38
39namespace endpoint {
40class DbServiceEndpoint;
41class ContentFileEndpoint;
42} // namespace endpoint
43
44namespace file_system {
45
46using ContentFilePtr = std::shared_ptr<mrs::endpoint::ContentFileEndpoint>;
47using ContentFileWeakPtr = std::weak_ptr<mrs::endpoint::ContentFileEndpoint>;
48
50 public:
52
53 std::string parse_uri_path(const std::string &uri) override;
54 std::string parse_string_path(const std::string &path) override;
55 void check_access(const std::string &path, int64_t flags) override;
56 void create_directory(const std::string &path) override;
57 void remove(const std::string &path) override;
58 std::shared_ptr<shcore::polyglot::ISeekable_channel> new_byte_channel(
59 const std::string &path) override;
60 std::shared_ptr<shcore::polyglot::IDirectory_stream> new_directory_stream(
61 const std::string &path) override;
62 std::string to_absolute_path(const std::string &path) override;
63 std::string to_real_path(const std::string &path) override;
64
65 ~DbServiceFileSystem() override = default;
66
67 private:
69 void traverse_files(std::function<bool(const ContentFilePtr &)> callback);
70 ContentFilePtr lookup_file(const std::string &request_path);
71};
72
73} // namespace file_system
74} // namespace mrs
75
76#endif // ROUTER_SRC_MYSQL_REST_SERVICE_SRC_MRS_FILE_SYSTEM_FILE_SYSTEM_H_
Definition: db_service_endpoint.h:54
Definition: db_service_file_system.h:49
std::string parse_string_path(const std::string &path) override
Parses a path from a String.
Definition: db_service_file_system.cc:161
void remove(const std::string &path) override
Deletes a file.
Definition: db_service_file_system.cc:189
void check_access(const std::string &path, int64_t flags) override
Checks existence and accessibility of a file.
Definition: db_service_file_system.cc:165
std::shared_ptr< shcore::polyglot::ISeekable_channel > new_byte_channel(const std::string &path) override
Opens or creates a file returning a SeekableByteChannel to access the file content.
Definition: db_service_file_system.cc:195
std::shared_ptr< shcore::polyglot::IDirectory_stream > new_directory_stream(const std::string &path) override
Returns directory entries.
Definition: db_service_file_system.cc:227
void create_directory(const std::string &path) override
Creates a directory.
Definition: db_service_file_system.cc:184
void traverse_files(std::function< bool(const ContentFilePtr &)> callback)
Definition: db_service_file_system.cc:117
DbServiceFileSystem(endpoint::DbServiceEndpoint *endpoint)
Definition: db_service_file_system.cc:114
std::string to_absolute_path(const std::string &path) override
Resolves given path to an absolute path.
Definition: db_service_file_system.cc:232
ContentFilePtr lookup_file(const std::string &request_path)
Definition: db_service_file_system.cc:140
std::string to_real_path(const std::string &path) override
Returns the real (canonical) path of an existing file.
Definition: db_service_file_system.cc:236
endpoint::DbServiceEndpoint * m_service_endpoint
Definition: db_service_file_system.h:68
std::string parse_uri_path(const std::string &uri) override
Parses a path from an URI.
Definition: db_service_file_system.cc:157
Definition: polyglot_file_system.h:185
static int flags[50]
Definition: hp_test1.cc:40
static char * path
Definition: mysqldump.cc:150
std::shared_ptr< mrs::endpoint::ContentFileEndpoint > ContentFilePtr
Definition: db_service_file_system.h:46
std::weak_ptr< mrs::endpoint::ContentFileEndpoint > ContentFileWeakPtr
Definition: db_service_file_system.h:47
Definition: authorize_manager.h:48