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

More work on the CLI plus added a new function getarchivefilebyid to the...

More work on the CLI plus added a new function getarchivefilebyid to the scheduler and the catalogue
parent 4e4a6a7a
......@@ -165,7 +165,8 @@ public:
virtual std::list<cta::common::dataStructures::ArchiveFile> getArchiveFiles(const cta::common::dataStructures::SecurityIdentity &requester, const std::string &id, const std::string &eosid,
const std::string &copynb, const std::string &tapepool, const std::string &vid, const std::string &owner, const std::string &group, const std::string &storageclass, const std::string &path) = 0;
virtual cta::common::dataStructures::ArchiveFileSummary getArchiveFileSummary(const cta::common::dataStructures::SecurityIdentity &requester, const std::string &id, const std::string &eosid,
const std::string &copynb, const std::string &tapepool, const std::string &vid, const std::string &owner, const std::string &group, const std::string &storageclass, const std::string &path) = 0;
const std::string &copynb, const std::string &tapepool, const std::string &vid, const std::string &owner, const std::string &group, const std::string &storageclass, const std::string &path) = 0;
virtual cta::common::dataStructures::ArchiveFile getArchiveFileById(const std::string &id) = 0;
virtual void setDriveStatus(const cta::common::dataStructures::SecurityIdentity &requester, const std::string &driveName, const bool up, const bool force) = 0;
......
......@@ -405,6 +405,13 @@ cta::common::dataStructures::ArchiveFileSummary cta::catalogue::DummyCatalogue::
const std::string &copynb, const std::string &tapepool, const std::string &vid, const std::string &owner, const std::string &group, const std::string &storageclass, const std::string &path) {
return cta::common::dataStructures::ArchiveFileSummary();
}
//------------------------------------------------------------------------------
// getArchiveFileById
//------------------------------------------------------------------------------
cta::common::dataStructures::ArchiveFile cta::catalogue::DummyCatalogue::getArchiveFileById(const std::string &id){
return cta::common::dataStructures::ArchiveFile();
}
//------------------------------------------------------------------------------
// setDriveStatus
......
......@@ -138,6 +138,7 @@ public:
const std::string &copynb, const std::string &tapepool, const std::string &vid, const std::string &owner, const std::string &group, const std::string &storageclass, const std::string &path);
virtual cta::common::dataStructures::ArchiveFileSummary getArchiveFileSummary(const cta::common::dataStructures::SecurityIdentity &requester, const std::string &id, const std::string &eosid,
const std::string &copynb, const std::string &tapepool, const std::string &vid, const std::string &owner, const std::string &group, const std::string &storageclass, const std::string &path);
virtual cta::common::dataStructures::ArchiveFile getArchiveFileById(const std::string &id);
virtual void setDriveStatus(const cta::common::dataStructures::SecurityIdentity &requester, const std::string &driveName, const bool up, const bool force);
/**
......
......@@ -405,6 +405,13 @@ cta::common::dataStructures::ArchiveFileSummary cta::catalogue::MockCatalogue::g
const std::string &copynb, const std::string &tapepool, const std::string &vid, const std::string &owner, const std::string &group, const std::string &storageclass, const std::string &path) {
return cta::common::dataStructures::ArchiveFileSummary();
}
//------------------------------------------------------------------------------
// getArchiveFileById
//------------------------------------------------------------------------------
cta::common::dataStructures::ArchiveFile cta::catalogue::MockCatalogue::getArchiveFileById(const std::string &id){
return cta::common::dataStructures::ArchiveFile();
}
//------------------------------------------------------------------------------
// setDriveStatus
......
......@@ -138,6 +138,7 @@ public:
const std::string &copynb, const std::string &tapepool, const std::string &vid, const std::string &owner, const std::string &group, const std::string &storageclass, const std::string &path);
virtual cta::common::dataStructures::ArchiveFileSummary getArchiveFileSummary(const cta::common::dataStructures::SecurityIdentity &requester, const std::string &id, const std::string &eosid,
const std::string &copynb, const std::string &tapepool, const std::string &vid, const std::string &owner, const std::string &group, const std::string &storageclass, const std::string &path);
virtual cta::common::dataStructures::ArchiveFile getArchiveFileById(const std::string &id);
virtual void setDriveStatus(const cta::common::dataStructures::SecurityIdentity &requester, const std::string &driveName, const bool up, const bool force);
/**
......
......@@ -189,6 +189,7 @@ virtual std::list<ArchiveFile> getArchiveFiles
const std::string &vid, const std::string &owner, const std::string &group, const std::string &storageclass, const std::string &path);
virtual ArchiveFileSummary getArchiveFileSummary (const SecurityIdentity &requester, const std::string &id, const std::string &eosid, const std::string &copynb, const std::string &tapepool,
const std::string &vid, const std::string &owner, const std::string &group, const std::string &storageclass, const std::string &path);
virtual ArchiveFile getArchiveFileById (const std::string &id);
virtual ReadTestResult readTest (const SecurityIdentity &requester, const std::string &driveName, const std::string &vid, const uint64_t firstFSeq, const uint64_t lastFSeq,
const bool checkChecksum, const std::string &output, const std::string &tag) const; //when output=="null" discard the data read
......
......@@ -88,5 +88,6 @@ virtual std::list<ArchiveFile> getArchiveFiles
const std::string &vid, const std::string &owner, const std::string &group, const std::string &storageclass, const std::string &path);
virtual ArchiveFileSummary getArchiveFileSummary (const SecurityIdentity &requester, const std::string &id, const std::string &eosid, const std::string &copynb, const std::string &tapepool,
const std::string &vid, const std::string &owner, const std::string &group, const std::string &storageclass, const std::string &path);
virtual ArchiveFile getArchiveFileById (const std::string &id);
virtual void setDriveStatus (const SecurityIdentity &requester, const std::string &driveName, const bool up, const bool force);
......@@ -658,6 +658,13 @@ cta::common::dataStructures::ArchiveFileSummary cta::Scheduler::getArchiveFileSu
return cta::common::dataStructures::ArchiveFileSummary();
}
//------------------------------------------------------------------------------
// getArchiveFileById
//------------------------------------------------------------------------------
cta::common::dataStructures::ArchiveFile cta::Scheduler::getArchiveFileById(const std::string &id){
return cta::common::dataStructures::ArchiveFile();
}
//------------------------------------------------------------------------------
// readTest
//------------------------------------------------------------------------------
......
......@@ -210,6 +210,7 @@ public:
const std::string &copynb, const std::string &tapepool, const std::string &vid, const std::string &owner, const std::string &group, const std::string &storageclass, const std::string &path);
virtual cta::common::dataStructures::ArchiveFileSummary getArchiveFileSummary(const cta::common::dataStructures::SecurityIdentity &requester, const std::string &id, const std::string &eosid,
const std::string &copynb, const std::string &tapepool, const std::string &vid, const std::string &owner, const std::string &group, const std::string &storageclass, const std::string &path);
virtual cta::common::dataStructures::ArchiveFile getArchiveFileById(const std::string &id);
virtual cta::common::dataStructures::ReadTestResult readTest(const cta::common::dataStructures::SecurityIdentity &requester, const std::string &driveName, const std::string &vid, const uint64_t firstFSeq, const uint64_t lastFSeq,
const bool checkChecksum, const std::string &output, const std::string &tag) const; //when output=="null" discard the data read
......
......@@ -1810,6 +1810,63 @@ void XrdProFile::xCom_listpendingarchives(const std::vector<std::string> &tokens
void XrdProFile::xCom_listpendingretrieves(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &requester) {
std::stringstream help;
help << tokens[0] << " lpr/listpendingretrieves [--vid/-v <vid>] [--extended/-x]" << std::endl;
std::string vid = getOptionValue(tokens, "-v", "--vid");
bool extended = hasOption(tokens, "-x", "--extended");
std::map<std::string, std::list<cta::common::dataStructures::RetrieveJob> > result;
if(vid.empty()) {
result = m_scheduler->getPendingRetrieveJobs(requester);
}
else {
std::list<cta::common::dataStructures::RetrieveJob> list = m_scheduler->getPendingRetrieveJobs(requester, vid);
if(list.size()>0) {
result[vid] = list;
}
}
if(result.size()>0) {
if(extended) {
std::vector<std::vector<std::string>> responseTable;
std::vector<std::string> header = {"vid","id","copy no.","fseq","block id","size","user","group","instance","path","diskpool","diskpool throughput"};
responseTable.push_back(header);
for(auto it = result.cbegin(); it != result.cend(); it++) {
for(auto jt = it->second.cbegin(); jt != it->second.cend(); jt++) {
std::vector<std::string> currentRow;
currentRow.push_back(it->first);
currentRow.push_back(jt->getRequest().getArchiveFileID());
cta::common::dataStructures::ArchiveFile file = m_scheduler->getArchiveFileById(jt->getRequest().getArchiveFileID());
currentRow.push_back(std::to_string((unsigned long long)jt->getTapeCopies()[it->first].first));
currentRow.push_back(std::to_string((unsigned long long)jt->getTapeCopies()[it->first].second.getFSeq()));
currentRow.push_back(std::to_string((unsigned long long)jt->getTapeCopies()[it->first].second.getBlockId()));
currentRow.push_back(std::to_string((unsigned long long)file.getFileSize()));
currentRow.push_back(jt->getRequest().getRequester().getUserName());
currentRow.push_back(jt->getRequest().getRequester().getGroupName());
currentRow.push_back(jt->getRequest().getDrData().getDrInstance());
currentRow.push_back(jt->getRequest().getDrData().getDrPath());
currentRow.push_back(jt->getRequest().getDiskpoolName());
currentRow.push_back(std::to_string((unsigned long long)jt->getRequest().getDiskpoolThroughput()));
responseTable.push_back(currentRow);
}
}
m_data = formatResponse(responseTable);
}
else {
std::vector<std::vector<std::string>> responseTable;
std::vector<std::string> header = {"vid","total files","total size"};
responseTable.push_back(header);
for(auto it = result.cbegin(); it != result.cend(); it++) {
std::vector<std::string> currentRow;
currentRow.push_back(it->first);
currentRow.push_back(std::to_string((unsigned long long)it->second.size()));
uint64_t size=0;
for(auto jt = it->second.cbegin(); jt != it->second.cend(); jt++) {
cta::common::dataStructures::ArchiveFile file = m_scheduler->getArchiveFileById(jt->getRequest().getArchiveFileID());
size += file.getFileSize();
}
currentRow.push_back(std::to_string((unsigned long long)size));
responseTable.push_back(currentRow);
}
m_data = formatResponse(responseTable);
}
}
}
//------------------------------------------------------------------------------
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment