be/src/cloud/cloud_snapshot_loader.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 "cloud/cloud_tablet.h" |
21 | | #include "common/status.h" |
22 | | #include "runtime/snapshot_loader.h" |
23 | | #include "storage/storage_policy.h" |
24 | | |
25 | | namespace doris { |
26 | | #include "common/compile_check_begin.h" |
27 | | |
28 | | class CloudStorageEngine; |
29 | | |
30 | | class CloudSnapshotLoader : public BaseSnapshotLoader { |
31 | | public: |
32 | | CloudSnapshotLoader(CloudStorageEngine& engine, ExecEnv* env, int64_t job_id, int64_t task_id, |
33 | | const TNetworkAddress& broker_addr = {}, |
34 | | const std::map<std::string, std::string>& broker_prop = {}); |
35 | | |
36 | 0 | ~CloudSnapshotLoader() override {}; |
37 | | |
38 | | io::RemoteFileSystemSPtr storage_fs(); |
39 | | |
40 | | Status init(TStorageBackendType::type type, const std::string& location, std::string vault_id); |
41 | | |
42 | | Status upload(const std::map<std::string, std::string>& src_to_dest_path, |
43 | | std::map<int64_t, std::vector<std::string>>* tablet_files) override; |
44 | | |
45 | | Status download(const std::map<std::string, std::string>& src_to_dest_path, |
46 | | std::vector<int64_t>* downloaded_tablet_ids) override; |
47 | | |
48 | | protected: |
49 | | std::optional<StorageResource> _storage_resource; |
50 | | |
51 | | private: |
52 | | CloudStorageEngine& _engine; |
53 | | }; |
54 | | |
55 | | #include "common/compile_check_end.h" |
56 | | } // end namespace doris |