hycdong commented on code in PR #1112:
URL: https://github.com/apache/incubator-pegasus/pull/1112#discussion_r948702695


##########
src/rdsn/src/common/backup_restore_common.cpp:
##########
@@ -36,5 +44,41 @@ const std::string 
backup_restore_constant::BACKUP_ID("restore.backup_id");
 const std::string 
backup_restore_constant::SKIP_BAD_PARTITION("restore.skip_bad_partition");
 const std::string 
backup_restore_constant::RESTORE_PATH("restore.restore_path");
 
+std::string get_backup_root(const std::string &backup_root,
+                            const std::string &user_defined_root_path)
+{
+    if (user_defined_root_path.empty()) {
+        return backup_root;
+    }
+    return utils::filesystem::path_combine(user_defined_root_path, 
backup_root);
+}
+
+std::string get_backup_path(const std::string &root,
+                            const std::string &app_name,
+                            const int32_t app_id,
+                            const int64_t backup_id,
+                            const bool is_compatible)
+{
+    std::string str_app = app_name + "_" + std::to_string(app_id);
+    std::stringstream ss;
+    if (!is_compatible) {
+        ss << root << "/" << str_app << "/" << backup_id;
+    } else {
+        ss << root << "/" << backup_id << "/" << str_app;
+    }
+    return ss.str();

Review Comment:
   Done, and I resolve the following similar conversation.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to