Commit ff068ed4 authored by Daniele Kruse's avatar Daniele Kruse
Browse files

More work on the CLI

parent e70d1388
......@@ -59,7 +59,6 @@
#include "common/dataStructures/User.hpp"
#include "common/dataStructures/UserIdentity.hpp"
#include "common/dataStructures/VerifyInfo.hpp"
#include "common/dataStructures/VerifyType.hpp"
#include "common/dataStructures/WriteTestResult.hpp"
namespace cta {
......
......@@ -26,9 +26,9 @@ cta::common::dataStructures::RepackInfo::RepackInfo() {
m_creationLogSet = false;
m_errorsSet = false;
m_filesFailedSet = false;
m_filesMigratedSet = false;
m_filesToMigrSet = false;
m_filesToRecallSet = false;
m_filesArchivedSet = false;
m_filesToArchiveSet = false;
m_filesToRetrieveSet = false;
m_repackStatusSet = false;
m_repackTypeSet = false;
m_tagSet = false;
......@@ -50,9 +50,9 @@ bool cta::common::dataStructures::RepackInfo::allFieldsSet() const {
return m_creationLogSet
&& m_errorsSet
&& m_filesFailedSet
&& m_filesMigratedSet
&& m_filesToMigrSet
&& m_filesToRecallSet
&& m_filesArchivedSet
&& m_filesToArchiveSet
&& m_filesToRetrieveSet
&& m_repackStatusSet
&& m_repackTypeSet
&& m_tagSet
......@@ -82,7 +82,7 @@ cta::common::dataStructures::EntryLog cta::common::dataStructures::RepackInfo::g
//------------------------------------------------------------------------------
// setErrors
//------------------------------------------------------------------------------
void cta::common::dataStructures::RepackInfo::setErrors(const std::map<int,std::string> &errors) {
void cta::common::dataStructures::RepackInfo::setErrors(const std::map<uint64_t,std::string> &errors) {
m_errors = errors;
m_errorsSet = true;
}
......@@ -90,7 +90,7 @@ void cta::common::dataStructures::RepackInfo::setErrors(const std::map<int,std::
//------------------------------------------------------------------------------
// getErrors
//------------------------------------------------------------------------------
std::map<int,std::string> cta::common::dataStructures::RepackInfo::getErrors() const {
std::map<uint64_t,std::string> cta::common::dataStructures::RepackInfo::getErrors() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the RepackInfo have been set!");
}
......@@ -118,55 +118,55 @@ uint64_t cta::common::dataStructures::RepackInfo::getFilesFailed() const {
//------------------------------------------------------------------------------
// setFilesMigrated
//------------------------------------------------------------------------------
void cta::common::dataStructures::RepackInfo::setFilesMigrated(const uint64_t filesMigrated) {
m_filesMigrated = filesMigrated;
m_filesMigratedSet = true;
void cta::common::dataStructures::RepackInfo::setFilesArchived(const uint64_t filesArchived) {
m_filesArchived = filesArchived;
m_filesArchivedSet = true;
}
//------------------------------------------------------------------------------
// getFilesMigrated
//------------------------------------------------------------------------------
uint64_t cta::common::dataStructures::RepackInfo::getFilesMigrated() const {
uint64_t cta::common::dataStructures::RepackInfo::getFilesArchived() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the RepackInfo have been set!");
}
return m_filesMigrated;
return m_filesArchived;
}
//------------------------------------------------------------------------------
// setFilesToMigr
//------------------------------------------------------------------------------
void cta::common::dataStructures::RepackInfo::setFilesToMigr(const uint64_t filesToMigr) {
m_filesToMigr = filesToMigr;
m_filesToMigrSet = true;
void cta::common::dataStructures::RepackInfo::setFilesToArchive(const uint64_t filesToArchive) {
m_filesToArchive = filesToArchive;
m_filesToArchiveSet = true;
}
//------------------------------------------------------------------------------
// getFilesToMigr
//------------------------------------------------------------------------------
uint64_t cta::common::dataStructures::RepackInfo::getFilesToMigr() const {
uint64_t cta::common::dataStructures::RepackInfo::getFilesToArchive() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the RepackInfo have been set!");
}
return m_filesToMigr;
return m_filesToArchive;
}
//------------------------------------------------------------------------------
// setFilesToRecall
//------------------------------------------------------------------------------
void cta::common::dataStructures::RepackInfo::setFilesToRecall(const uint64_t filesToRecall) {
m_filesToRecall = filesToRecall;
m_filesToRecallSet = true;
void cta::common::dataStructures::RepackInfo::setFilesToRetrieve(const uint64_t filesToRetrieve) {
m_filesToRetrieve = filesToRetrieve;
m_filesToRetrieveSet = true;
}
//------------------------------------------------------------------------------
// getFilesToRecall
//------------------------------------------------------------------------------
uint64_t cta::common::dataStructures::RepackInfo::getFilesToRecall() const {
uint64_t cta::common::dataStructures::RepackInfo::getFilesToRetrieve() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the RepackInfo have been set!");
}
return m_filesToRecall;
return m_filesToRetrieve;
}
//------------------------------------------------------------------------------
......
......@@ -47,20 +47,20 @@ public:
void setCreationLog(const cta::common::dataStructures::EntryLog &creationLog);
cta::common::dataStructures::EntryLog getCreationLog() const;
void setErrors(const std::map<int,std::string> &errors);
std::map<int,std::string> getErrors() const;
void setErrors(const std::map<uint64_t,std::string> &errors);
std::map<uint64_t,std::string> getErrors() const;
void setFilesFailed(const uint64_t filesFailed);
uint64_t getFilesFailed() const;
void setFilesMigrated(const uint64_t filesMigrated);
uint64_t getFilesMigrated() const;
void setFilesArchived(const uint64_t filesArchived);
uint64_t getFilesArchived() const;
void setFilesToMigr(const uint64_t filesToMigr);
uint64_t getFilesToMigr() const;
void setFilesToArchive(const uint64_t filesToArchive);
uint64_t getFilesToArchive() const;
void setFilesToRecall(const uint64_t filesToRecall);
uint64_t getFilesToRecall() const;
void setFilesToRetrieve(const uint64_t filesToRetrieve);
uint64_t getFilesToRetrieve() const;
void setRepackStatus(const std::string &repackStatus);
std::string getRepackStatus() const;
......@@ -91,20 +91,20 @@ private:
cta::common::dataStructures::EntryLog m_creationLog;
bool m_creationLogSet;
std::map<int,std::string> m_errors;
std::map<uint64_t,std::string> m_errors;
bool m_errorsSet;
uint64_t m_filesFailed;
bool m_filesFailedSet;
uint64_t m_filesMigrated;
bool m_filesMigratedSet;
uint64_t m_filesArchived;
bool m_filesArchivedSet;
uint64_t m_filesToMigr;
bool m_filesToMigrSet;
uint64_t m_filesToArchive;
bool m_filesToArchiveSet;
uint64_t m_filesToRecall;
bool m_filesToRecallSet;
uint64_t m_filesToRetrieve;
bool m_filesToRetrieveSet;
std::string m_repackStatus;
bool m_repackStatusSet;
......
......@@ -24,6 +24,7 @@
//------------------------------------------------------------------------------
cta::common::dataStructures::VerifyInfo::VerifyInfo() {
m_creationLogSet = false;
m_errorsSet = false;
m_filesFailedSet = false;
m_filesToVerifySet = false;
m_filesVerifiedSet = false;
......@@ -31,7 +32,6 @@ cta::common::dataStructures::VerifyInfo::VerifyInfo() {
m_totalFilesSet = false;
m_totalSizeSet = false;
m_verifyStatusSet = false;
m_verifyTypeSet = false;
m_vidSet = false;
}
......@@ -46,6 +46,7 @@ cta::common::dataStructures::VerifyInfo::~VerifyInfo() throw() {
//------------------------------------------------------------------------------
bool cta::common::dataStructures::VerifyInfo::allFieldsSet() const {
return m_creationLogSet
&& m_errorsSet
&& m_filesFailedSet
&& m_filesToVerifySet
&& m_filesVerifiedSet
......@@ -53,7 +54,6 @@ bool cta::common::dataStructures::VerifyInfo::allFieldsSet() const {
&& m_totalFilesSet
&& m_totalSizeSet
&& m_verifyStatusSet
&& m_verifyTypeSet
&& m_vidSet;
}
......@@ -75,6 +75,24 @@ cta::common::dataStructures::EntryLog cta::common::dataStructures::VerifyInfo::g
return m_creationLog;
}
//------------------------------------------------------------------------------
// setErrors
//------------------------------------------------------------------------------
void cta::common::dataStructures::VerifyInfo::setErrors(const std::map<uint64_t,std::string> &errors) {
m_errors = errors;
m_errorsSet = true;
}
//------------------------------------------------------------------------------
// getErrors
//------------------------------------------------------------------------------
std::map<uint64_t,std::string> cta::common::dataStructures::VerifyInfo::getErrors() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the RepackInfo have been set!");
}
return m_errors;
}
//------------------------------------------------------------------------------
// setFilesFailed
//------------------------------------------------------------------------------
......@@ -201,24 +219,6 @@ std::string cta::common::dataStructures::VerifyInfo::getVerifyStatus() const {
return m_verifyStatus;
}
//------------------------------------------------------------------------------
// setVerifyType
//------------------------------------------------------------------------------
void cta::common::dataStructures::VerifyInfo::setVerifyType(const cta::common::dataStructures::VerifyType &verifyType) {
m_verifyType = verifyType;
m_verifyTypeSet = true;
}
//------------------------------------------------------------------------------
// getVerifyType
//------------------------------------------------------------------------------
cta::common::dataStructures::VerifyType cta::common::dataStructures::VerifyInfo::getVerifyType() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the VerifyInfo have been set!");
}
return m_verifyType;
}
//------------------------------------------------------------------------------
// setVid
//------------------------------------------------------------------------------
......
......@@ -24,7 +24,6 @@
#include <string>
#include "common/dataStructures/EntryLog.hpp"
#include "common/dataStructures/VerifyType.hpp"
namespace cta {
namespace common {
......@@ -47,6 +46,9 @@ public:
void setCreationLog(const cta::common::dataStructures::EntryLog &creationLog);
cta::common::dataStructures::EntryLog getCreationLog() const;
void setErrors(const std::map<uint64_t,std::string> &errors);
std::map<uint64_t,std::string> getErrors() const;
void setFilesFailed(const uint64_t filesFailed);
uint64_t getFilesFailed() const;
......@@ -68,9 +70,6 @@ public:
void setVerifyStatus(const std::string &verifyStatus);
std::string getVerifyStatus() const;
void setVerifyType(const cta::common::dataStructures::VerifyType &verifyType);
cta::common::dataStructures::VerifyType getVerifyType() const;
void setVid(const std::string &vid);
std::string getVid() const;
......@@ -85,6 +84,9 @@ private:
cta::common::dataStructures::EntryLog m_creationLog;
bool m_creationLogSet;
std::map<uint64_t,std::string> m_errors;
bool m_errorsSet;
uint64_t m_filesFailed;
bool m_filesFailedSet;
......@@ -106,9 +108,6 @@ private:
std::string m_verifyStatus;
bool m_verifyStatusSet;
cta::common::dataStructures::VerifyType m_verifyType;
bool m_verifyTypeSet;
std::string m_vid;
bool m_vidSet;
......
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
namespace cta {
namespace common {
namespace dataStructures {
enum VerifyType {
complete,
partial
};
} // namespace dataStructures
} // namespace common
} // namespace cta
\ No newline at end of file
......@@ -67,7 +67,7 @@ cta de/dedication add/ch/rm/ls:
ls
cta re/repack add/rm/ls/err:
add [--vid/-v <vid>] [--expandandrepack/-d or --justexpand/-e or --justrepack/-r] [--tag/-t <tag_name>]
add [--vid/-v <vid>] [--justexpand/-e or --justrepack/-r] [--tag/-t <tag_name>]
rm [--vid/-v <vid>]
ls [--vid/-v <vid>]
err --vid/-v <vid>
......@@ -75,7 +75,7 @@ cta re/repack add/rm/ls/err:
cta sh/shrink --tapepool/-t <tapepool_name>
cta ve/verify add/rm/ls/err:
add [--vid/-v <vid>] [--complete/-c] [--partial/-p <number_of_files_per_tape>] [--tag/-t <tag_name>]
add [--vid/-v <vid>] [--complete/-c or --partial/-p <number_of_files_per_tape>] [--tag/-t <tag_name>]
rm [--vid/-v <vid>]
ls [--vid/-v <vid>]
err --vid/-v <vid>
......@@ -84,8 +84,8 @@ cta af/archivefile ls [--id/-I <archive_file_id>] [--copynb/-c <copy_no>] [--vid
cta te/test read/write (to be run on an empty self-dedicated drive; it is a synchronous command that returns performance stats and errors; all locations are local to the tapeserver):
read --drive/-d <drive_name> --vid/-v <vid> --firstfseq/-f <first_fseq> --lastfseq/-l <last_fseq> --checkchecksum/-c --retries_per_file/-r <number_of_retries_per_file> [--outputdir/-o <output_dir> or --null/-n] [--tag/-t <tag_name>]
write --drive/-d <drive_name> --vid/-v <vid> --number/-n <number_of_files> [--size/-s <file_size> or --randomsize/-r] [--zero/-z or --urandom/-u] [--tag/-t <tag_name>]
write --drive/-d <drive_name> --vid/-v <vid> [--file/-f <filename> or --filelist/-f <filename_with_file_list>] [--tag/-t <tag_name>]
write_rand --drive/-d <drive_name> --vid/-v <vid> --number/-n <number_of_files> [--size/-s <file_size> or --randomsize/-r] [--zero/-z or --urandom/-u] [--tag/-t <tag_name>]
write_def --drive/-d <drive_name> --vid/-v <vid> [--file/-f <filename> or --filelist/-f <filename_with_file_list>] [--tag/-t <tag_name>]
cta dr/drive up/down (it is a synchronous command):
up --drive/-d <drive_name>
......
......@@ -613,7 +613,7 @@ void cta::Scheduler::shrink(const cta::common::dataStructures::SecurityIdentity
//------------------------------------------------------------------------------
// verify
//------------------------------------------------------------------------------
void cta::Scheduler::verify(const cta::common::dataStructures::SecurityIdentity &requester, const std::string &vid, const std::string &tag, const cta::common::dataStructures::VerifyType) {
void cta::Scheduler::verify(const cta::common::dataStructures::SecurityIdentity &requester, const std::string &vid, const std::string &tag, const uint64_t numberOfFiles) {
}
......
......@@ -56,7 +56,6 @@
#include "common/dataStructures/User.hpp"
#include "common/dataStructures/UserIdentity.hpp"
#include "common/dataStructures/VerifyInfo.hpp"
#include "common/dataStructures/VerifyType.hpp"
#include "common/dataStructures/WriteTestResult.hpp"
#include "common/exception/Exception.hpp"
......@@ -197,7 +196,7 @@ public:
virtual void shrink(const cta::common::dataStructures::SecurityIdentity &requester, const std::string &tapepool); // removes extra tape copies from a specific pool(usually an "_2" pool)
virtual void verify(const cta::common::dataStructures::SecurityIdentity &requester, const std::string &vid, const std::string &tag, const cta::common::dataStructures::VerifyType);
virtual void verify(const cta::common::dataStructures::SecurityIdentity &requester, const std::string &vid, const std::string &tag, const uint64_t numberOfFiles); //if last argument is 0, all files are verified
virtual void cancelVerify(const cta::common::dataStructures::SecurityIdentity &requester, const std::string &vid);
virtual std::list<cta::common::dataStructures::VerifyInfo> getVerifys(const cta::common::dataStructures::SecurityIdentity &requester) const;
virtual cta::common::dataStructures::VerifyInfo getVerify(const cta::common::dataStructures::SecurityIdentity &requester, const std::string &vid) const;
......
......@@ -1272,26 +1272,19 @@ void XrdProFile::xCom_dedication(const std::vector<std::string> &tokens, const c
type_s = "readwrite";
break;
}
char timebuffer[100];
time_t fromtimeStamp=it->getFromTimestamp();
time_t untiltimeStamp=it->getUntilTimestamp();
struct tm *tm = localtime(&fromtimeStamp);
if(strftime(timebuffer, 100, "%d/%m/%Y", tm)==0) {
m_data = "Error converting \"from\" date!\n";
}
std::string fromTime_s(timebuffer);
tm = localtime(&untiltimeStamp);
if(strftime(timebuffer, 100, "%d/%m/%Y", tm)==0) {
m_data = "Error converting \"to\" date!\n";
}
std::string untilTime_s(timebuffer);
time_t fromTime = it->getFromTimestamp();
time_t untilTime = it->getUntilTimestamp();
std::string fromTimeString(ctime(&fromTime));
std::string untilTimeString(ctime(&untilTime));
fromTimeString=fromTimeString.substr(0,24); //remove the newline
untilTimeString=untilTimeString.substr(0,24); //remove the newline
currentRow.push_back(it->getDriveName());
currentRow.push_back(type_s);
currentRow.push_back(it->getVid());
currentRow.push_back(it->getUserGroup());
currentRow.push_back(it->getTag());
currentRow.push_back(fromTime_s);
currentRow.push_back(untilTime_s);
currentRow.push_back(fromTimeString);
currentRow.push_back(untilTimeString);
addLogInfoToResponseRow(currentRow, it->getCreationLog(), it->getLastModificationLog());
currentRow.push_back(it->getComment());
responseTable.push_back(currentRow);
......@@ -1310,10 +1303,104 @@ void XrdProFile::xCom_dedication(const std::vector<std::string> &tokens, const c
void XrdProFile::xCom_repack(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &requester) {
std::stringstream help;
help << tokens[0] << " re/repack add/rm/ls/err:" << std::endl
<< "\tadd --vid/-v <vid> [--expandandrepack/-d or --justexpand/-e or --justrepack/-r] [--tag/-t <tag_name>]" << std::endl
<< "\tadd --vid/-v <vid> [--justexpand/-e or --justrepack/-r] [--tag/-t <tag_name>]" << std::endl
<< "\trm --vid/-v <vid>" << std::endl
<< "\tls [--vid/-v <vid>]" << std::endl
<< "\terr --vid/-v <vid>" << std::endl;
if("add" == tokens[2] || "err" == tokens[2] || "rm" == tokens[2]) {
std::string vid = getOptionValue(tokens, "-v", "--vid");
if(vid.empty()) {
m_data = help.str();
return;
}
if("add" == tokens[2]) { //add
std::string tag = getOptionValue(tokens, "-t", "--tag");
bool justexpand = hasOption(tokens, "-e", "--justexpand");
bool justrepack = hasOption(tokens, "-r", "--justrepack");
if(justexpand&&justrepack) {
m_data = help.str();
return;
}
cta::common::dataStructures::RepackType type=cta::common::dataStructures::RepackType::expandandrepack;
if(justexpand) {
type=cta::common::dataStructures::RepackType::justexpand;
}
if(justrepack) {
type=cta::common::dataStructures::RepackType::justrepack;
}
m_scheduler->repack(requester, vid, tag, type);
}
else if("err" == tokens[2]) { //err
cta::common::dataStructures::RepackInfo info = m_scheduler->getRepack(requester, vid);
if(info.getErrors().size()>0) {
std::vector<std::vector<std::string>> responseTable;
std::vector<std::string> header = {"fseq","error message"};
responseTable.push_back(header);
for(auto it = info.getErrors().cbegin(); it != info.getErrors().cend(); it++) {
std::vector<std::string> currentRow;
currentRow.push_back(std::to_string((unsigned long long)it->first));
currentRow.push_back(it->second);
responseTable.push_back(currentRow);
}
m_data = formatResponse(responseTable);
}
}
else { //rm
m_scheduler->cancelRepack(requester, vid);
}
}
else if("ls" == tokens[2]) { //ls
std::list<cta::common::dataStructures::RepackInfo> list;
std::string vid = getOptionValue(tokens, "-v", "--vid");
if(vid.empty()) {
list = m_scheduler->getRepacks(requester);
}
else {
list.push_back(m_scheduler->getRepack(requester, vid));
}
if(list.size()>0) {
std::vector<std::vector<std::string>> responseTable;
std::vector<std::string> header = {"vid","files","size","type","tag","to retrieve","to archive","failed","archived","status","uid","gid","host","time"};
responseTable.push_back(header);
for(auto it = list.cbegin(); it != list.cend(); it++) {
std::string type_s;
switch(it->getRepackType()) {
case cta::common::dataStructures::RepackType::expandandrepack:
type_s = "expandandrepack";
break;
case cta::common::dataStructures::RepackType::justexpand:
type_s = "justexpand";
break;
case cta::common::dataStructures::RepackType::justrepack:
type_s = "justrepack";
break;
}
time_t creationTime = it->getCreationLog().getTime();
std::string creationTimeString(ctime(&creationTime));
creationTimeString=creationTimeString.substr(0,24); //remove the newline
std::vector<std::string> currentRow;
currentRow.push_back(it->getVid());
currentRow.push_back(std::to_string((unsigned long long)it->getTotalFiles()));
currentRow.push_back(std::to_string((unsigned long long)it->getTotalSize()));
currentRow.push_back(type_s);
currentRow.push_back(it->getTag());
currentRow.push_back(std::to_string((unsigned long long)it->getFilesToRetrieve()));//change names
currentRow.push_back(std::to_string((unsigned long long)it->getFilesToArchive()));
currentRow.push_back(std::to_string((unsigned long long)it->getFilesFailed()));
currentRow.push_back(std::to_string((unsigned long long)it->getFilesArchived()));
currentRow.push_back(it->getRepackStatus());
currentRow.push_back(std::to_string((unsigned long long)it->getCreationLog().getUser().getUid()));
currentRow.push_back(std::to_string((unsigned long long)it->getCreationLog().getUser().getGid()));
currentRow.push_back(it->getCreationLog().getHost());
currentRow.push_back(creationTimeString);
responseTable.push_back(currentRow);
}
m_data = formatResponse(responseTable);
}
}
else {
m_data = help.str();
}
}
//------------------------------------------------------------------------------
......@@ -1322,6 +1409,12 @@ void XrdProFile::xCom_repack(const std::vector<std::string> &tokens, const cta::
void XrdProFile::xCom_shrink(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &requester) {
std::stringstream help;
help << tokens[0] << " sh/shrink --tapepool/-t <tapepool_name>" << std::endl;
std::string tapepool = getOptionValue(tokens, "-t", "--tapepool");
if(tapepool.empty()) {
m_data = help.str();
return;
}
m_scheduler->shrink(requester, tapepool);
}
//------------------------------------------------------------------------------
......@@ -1330,10 +1423,89 @@ void XrdProFile::xCom_shrink(const std::vector<std::string> &tokens, const cta::
void XrdProFile::xCom_verify(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &requester) {
std::stringstream help;
help << tokens[0] << " ve/verify add/rm/ls/err:" << std::endl
<< "\tadd [--vid/-v <vid>] [--complete/-c] [--partial/-p <number_of_files_per_tape>] [--tag/-t <tag_name>]" << std::endl
<< "\tadd [--vid/-v <vid>] [--complete/-c or --partial/-p <number_of_files_per_tape>] [--tag/-t <tag_name>]" << std::endl
<< "\trm [--vid/-v <vid>]" << std::endl
<< "\tls [--vid/-v <vid>]" << std::endl
<< "\terr --vid/-v <vid>" << std::endl;
if("add" == tokens[2] || "err" == tokens[2] || "rm" == tokens[2]) {
std::string vid = getOptionValue(tokens, "-v", "--vid");
if(vid.empty()) {
m_data = help.str();
return;
}
if("add" == tokens[2]) { //add
std::string tag = getOptionValue(tokens, "-t", "--tag");
std::string numberOfFiles_s = getOptionValue(tokens, "-p", "--partial");
bool complete = hasOption(tokens, "-c", "--complete");
if(complete&&!numberOfFiles_s.empty()) {
m_data = help.str();
return;
}
uint64_t numberOfFiles=0; //0 means do a complete verification
if(!numberOfFiles_s.empty()) {
std::stringstream numberOfFiles_ss;
numberOfFiles_ss << numberOfFiles_s;
numberOfFiles_ss >> numberOfFiles;
}
m_scheduler->verify(requester, vid, tag, numberOfFiles);
}
else if("err" == tokens[2]) { //err
cta::common::dataStructures::VerifyInfo info = m_scheduler->getVerify(requester, vid);
if(info.getErrors().size()>0) {
std::vector<std::vector<std::string>> responseTable;
std::vector<std::string> header = {"fseq","error message"};
responseTable.push_back(header);
for(auto it = info.getErrors().cbegin(); it != info.getErrors().cend(); it++) {
std::vector<std::string> currentRow;
currentRow.push_back(std::to_string((unsigned long long)it->first));
currentRow.push_back(it->second);
responseTable.push_back(currentRow);
}
m_data = formatResponse(responseTable);
}
}
else { //rm