be/src/io/fs/http_file_system.h
Line | Count | Source |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | |
18 | | #pragma once |
19 | | |
20 | | #include <filesystem> |
21 | | #include <map> |
22 | | #include <memory> |
23 | | #include <string> |
24 | | #include <utility> |
25 | | #include <vector> |
26 | | |
27 | | #include "common/status.h" |
28 | | #include "io/fs/file_writer.h" |
29 | | #include "io/fs/http_file_reader.h" |
30 | | #include "io/fs/path.h" |
31 | | #include "io/fs/remote_file_system.h" |
32 | | #include "service/http/http_client.h" |
33 | | |
34 | | namespace doris::io { |
35 | | class HttpFileSystem final : public RemoteFileSystem { |
36 | | public: |
37 | | static Result<std::shared_ptr<HttpFileSystem>> create( |
38 | | std::string id, const std::string& uri, |
39 | | const std::map<std::string, std::string>& properties = {}); |
40 | 0 | ~HttpFileSystem() override = default; |
41 | | |
42 | | protected: |
43 | | Status file_size_impl(const Path& file, int64_t* file_size) const override; |
44 | | |
45 | | Status exists_impl(const Path& path, bool* res) const override; |
46 | | |
47 | | Status open_file_internal(const Path& file, FileReaderSPtr* reader, |
48 | | const FileReaderOptions& opts) override; |
49 | 0 | Status download_impl(const Path& remote_file, const Path& local_file) override { |
50 | 0 | return Status::NotSupported("not supported"); |
51 | 0 | } |
52 | | |
53 | | Status batch_upload_impl(const std::vector<Path>& local_files, |
54 | 0 | const std::vector<Path>& remote_files) override { |
55 | 0 | return Status::NotSupported("not supported"); |
56 | 0 | } |
57 | | |
58 | 0 | Status upload_impl(const Path& local_file, const Path& remote_file) override { |
59 | 0 | return Status::NotSupported("not supported"); |
60 | 0 | } |
61 | | |
62 | | Status open_file_impl(const Path& file, FileReaderSPtr* reader, |
63 | 0 | const FileReaderOptions* opts) override { |
64 | 0 | return Status::NotSupported("not suported"); |
65 | 0 | } |
66 | | |
67 | 0 | Status create_directory_impl(const Path& dir, bool failed_if_exists = false) override { |
68 | 0 | return Status::NotSupported("not supported"); |
69 | 0 | } |
70 | | |
71 | 0 | Status delete_file_impl(const Path& file) override { |
72 | 0 | return Status::NotSupported("not supported"); |
73 | 0 | } |
74 | | |
75 | 0 | Status batch_delete_impl(const std::vector<Path>& files) override { |
76 | 0 | return Status::NotSupported("not supported"); |
77 | 0 | } |
78 | | |
79 | 0 | Status delete_directory_impl(const Path& dir) override { |
80 | 0 | return Status::NotSupported("not supported"); |
81 | 0 | } |
82 | | |
83 | | Status create_file_impl(const Path& file, FileWriterPtr* writer, |
84 | 0 | const FileWriterOptions* opts) override { |
85 | 0 | return Status::NotSupported("not supported"); |
86 | 0 | } |
87 | | |
88 | | Status list_impl(const Path& dir, bool only_file, std::vector<FileInfo>* files, |
89 | 0 | bool* exists) override { |
90 | 0 | return Status::NotSupported("not supported"); |
91 | 0 | } |
92 | | |
93 | 0 | Status rename_impl(const Path& orig_name, const Path& new_name) override { |
94 | 0 | return Status::NotSupported("not supported"); |
95 | 0 | } |
96 | | |
97 | | private: |
98 | | HttpFileSystem(Path&& root_path, std::string id, std::map<std::string, std::string> properties); |
99 | | Status _init(const std::string& url); |
100 | | |
101 | | std::string _url; |
102 | | std::map<std::string, std::string> _properties; |
103 | | }; |
104 | | } // namespace doris::io |