empiredan commented on code in PR #2078:
URL: 
https://github.com/apache/incubator-pegasus/pull/2078#discussion_r1776896150


##########
src/replica/replica_stub.h:
##########
@@ -357,8 +365,36 @@ class replica_stub : public serverlet<replica_stub>, 
public ref_counter
                          bool restore_if_necessary,
                          bool is_duplication_follower,
                          const std::string &parent_dir = "");
-    // Load an existing replica which is located in 'dn' with 'dir' directory.
-    replica *load_replica(dir_node *dn, const char *dir);
+
+    using disk_dirs = std::vector<std::pair<dir_node *, 
std::vector<std::string>>>;
+
+    // Get the absolute dirs of all replicas for all disks.
+    disk_dirs get_all_disk_dirs() const;
+
+    // Get the dir name for a replica from a potentially longer path (both 
absolute and
+    // relative paths are possible).
+    static std::string get_replica_dir_name(const std::string &dir);

Review Comment:
   OK, added.



##########
src/replica/replica_stub.h:
##########
@@ -357,8 +365,36 @@ class replica_stub : public serverlet<replica_stub>, 
public ref_counter
                          bool restore_if_necessary,
                          bool is_duplication_follower,
                          const std::string &parent_dir = "");
-    // Load an existing replica which is located in 'dn' with 'dir' directory.
-    replica *load_replica(dir_node *dn, const char *dir);
+
+    using disk_dirs = std::vector<std::pair<dir_node *, 
std::vector<std::string>>>;
+
+    // Get the absolute dirs of all replicas for all disks.
+    disk_dirs get_all_disk_dirs() const;
+
+    // Get the dir name for a replica from a potentially longer path (both 
absolute and
+    // relative paths are possible).
+    static std::string get_replica_dir_name(const std::string &dir);
+
+    // Parse app id, partition id and app type from the dir name of a replica.
+    static bool
+    parse_replica_dir_name(const std::string &dir_name, gpid &pid, std::string 
&app_type);
+
+    // Load an existing replica which is located in `dn` with `dir`. Usually 
each different
+    // `dn` represents a unique disk. `dir` is the absolute path of the 
directory for a
+    // replica.
+    virtual replica_ptr load_replica(dir_node *dn, const char *dir);

Review Comment:
   OK.



-- 
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