Show also replica attributes.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Sun, 1 Dec 2013 19:06:37 +0000 (20:06 +0100)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Sun, 1 Dec 2013 19:06:37 +0000 (20:06 +0100)
run.cpp

diff --git a/run.cpp b/run.cpp
index cc3752e..89129c6 100644 (file)
--- a/run.cpp
+++ b/run.cpp
@@ -264,6 +264,7 @@ int main(int argc, char *argv[]) {
                        dmlite::ExtendedStat xstat;
                        dmlite::Replica replica;
                        std::vector<dmlite::Replica> replicas;
+                       std::vector<std::string> keys;
                        char *cmd, *path, *rfn;
                        size_t i;
                        int64_t replicaid;
@@ -274,6 +275,7 @@ int main(int argc, char *argv[]) {
                                return 1;
                        }
                        cmd = argv[3];
+                       replica = dmlite::Replica();
                        if (strcasecmp(cmd, "add") == 0 && argc >= 6) {
                                operation = "add replica";
                                path = argv[4];
@@ -291,6 +293,15 @@ int main(int argc, char *argv[]) {
                                printf("Replicas of '%s':\n", path);
                                for (i = 0; i < replicas.size(); i++) {
                                        printf("  %lu: inode %lu, server '%s', rfn '%s'\n", replicas[i].replicaid, replicas[i].fileid, replicas[i].server.c_str(), replicas[i].rfn.c_str());
+                                       if (replicas[i].size()) {
+                                               keys = replicas[i].getKeys();
+                                               printf("\t");
+                                               for (size_t j = 0; j < keys.size(); j++) {
+                                                       if (j) printf(", ");
+                                                       printf("%s = '%s'", keys[j].c_str(), replicas[i].getString(keys[j]).c_str());
+                                               }
+                                               printf("\n");
+                                       }
                                }
                        } else if (strcasecmp(cmd, "delete") == 0 && argc >= 6) {
                                operation = "delete replica";