break;
}
+
+ case 'p': {
+ dmlite::ExtendedStat xstat;
+ dmlite::Replica replica;
+ std::vector<dmlite::Replica> replicas;
+ char *cmd, *path, *rfn;
+ size_t i;
+
+ if (argc < 4) {
+ std::cerr << "Missing command" << std::endl;
+ return 1;
+ }
+ cmd = argv[3];
+ if (strcasecmp(cmd, "add") == 0 && argc >= 6) {
+ operation = "replica add";
+ path = argv[4];
+ rfn = argv[5];
+
+ xstat = catalog->extendedStat(path);
+ replica.fileid = xstat.stat.st_ino;
+ replica.rfn = rfn;
+ catalog->addReplica(replica);
+ } else if (strcasecmp(cmd, "list") == 0 && argc >= 5) {
+ operation = "replica list";
+ path = argv[4];
+
+ replicas = catalog->getReplicas(path);
+ 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());
+ }
+ } else {
+ std::cerr << "Bad aruments for 'p'" << std::endl;
+ return 1;
+ }
+ }
+
}
} catch (dmlite::DmException& e) {
std::cout << "Could not " << operation << "." << std::endl