dataroaring commented on code in PR #47300:
URL: https://github.com/apache/doris/pull/47300#discussion_r1956183031


##########
be/src/cloud/cloud_snapshot_loader.cpp:
##########
@@ -0,0 +1,234 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "cloud/cloud_snapshot_loader.h"
+
+#include <gen_cpp/Types_types.h>
+
+#include <unordered_map>
+
+#include "cloud/cloud_snapshot_mgr.h"
+#include "cloud/cloud_storage_engine.h"
+#include "common/logging.h"
+#include "io/fs/broker_file_system.h"
+#include "io/fs/file_system.h"
+#include "io/fs/hdfs_file_system.h"
+#include "io/fs/path.h"
+#include "io/fs/remote_file_system.h"
+#include "io/fs/s3_file_system.h"
+#include "olap/olap_common.h"
+#include "olap/olap_define.h"
+#include "olap/rowset/rowset_factory.h"
+#include "olap/rowset/rowset_meta.h"
+#include "olap/rowset/rowset_writer.h"
+#include "olap/rowset/rowset_writer_context.h"
+#include "olap/tablet.h"
+#include "util/slice.h"
+
+namespace doris {
+namespace {
+bool _end_with(std::string_view str, std::string_view match) {
+    return str.size() >= match.size() &&
+           str.compare(str.size() - match.size(), match.size(), match) == 0;
+}
+} // namespace
+
+CloudSnapshotLoader::CloudSnapshotLoader(CloudStorageEngine& engine, ExecEnv* 
env, int64_t job_id, int64_t task_id,
+                                         const TNetworkAddress& broker_addr,
+                                         const std::map<std::string, 
std::string>& broker_prop)
+        : BaseSnapshotLoader(env, job_id, task_id, broker_addr, broker_prop),
+          _engine(engine) {};
+
+Status CloudSnapshotLoader::init(TStorageBackendType::type type, const 
std::string& location, std::string vault_id) {
+    RETURN_IF_ERROR(BaseSnapshotLoader::init(type, location));
+    _storage_resource = _engine.get_storage_resource(vault_id);
+    if (!_storage_resource) {
+        return Status::InternalError("vault id not found, vault id {}", 
vault_id);
+    }
+    return Status::OK();
+}
+
+io::RemoteFileSystemSPtr CloudSnapshotLoader::storage_fs() {
+    return _storage_resource->fs;
+}
+
+Status CloudSnapshotLoader::upload(const std::map<std::string, std::string>& 
src_to_dest_path,
+                                   std::map<int64_t, 
std::vector<std::string>>* tablet_files) {
+    return Status::NotSupported("upload not supported");
+}
+
+Status CloudSnapshotLoader::download(const std::map<std::string, std::string>& 
src_to_dest_path,

Review Comment:
   the function is too large, we should split it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to