Skip to content
Snippets Groups Projects
Commit 271825ff authored by Michael Davis's avatar Michael Davis
Browse files

[cta-admin] Refactors all client-side stream command output

parent d58953e4
No related branches found
No related tags found
No related merge requests found
......@@ -89,16 +89,16 @@ void IStreamBuffer<cta::xrd::Data>::DataCallback(cta::xrd::Data record) const
// Format results in a tabular format for a human
else switch(record.data_case()) {
case Data::kAflsItem: formattedText.print(record.afls_item()); break;
case Data::kAflsSummary: TextFormatter::print(record.afls_summary()); break;
case Data::kFrlsItem: TextFormatter::print(record.frls_item()); break;
case Data::kFrlsSummary: TextFormatter::print(record.frls_summary()); break;
case Data::kLpaItem: TextFormatter::print(record.lpa_item()); break;
case Data::kLpaSummary: TextFormatter::print(record.lpa_summary()); break;
case Data::kLprItem: TextFormatter::print(record.lpr_item()); break;
case Data::kLprSummary: TextFormatter::print(record.lpr_summary()); break;
case Data::kTplsItem: TextFormatter::print(record.tpls_item()); break;
case Data::kTalsItem: TextFormatter::print(record.tals_item()); break;
case Data::kRelsItem: TextFormatter::print(record.rels_item()); break;
case Data::kAflsSummary: formattedText.print(record.afls_summary()); break;
case Data::kFrlsItem: formattedText.print(record.frls_item()); break;
case Data::kFrlsSummary: formattedText.print(record.frls_summary()); break;
case Data::kLpaItem: formattedText.print(record.lpa_item()); break;
case Data::kLpaSummary: formattedText.print(record.lpa_summary()); break;
case Data::kLprItem: formattedText.print(record.lpr_item()); break;
case Data::kLprSummary: formattedText.print(record.lpr_summary()); break;
case Data::kTplsItem: formattedText.print(record.tpls_item()); break;
case Data::kTalsItem: formattedText.print(record.tals_item()); break;
case Data::kRelsItem: formattedText.print(record.rels_item()); break;
default:
throw std::runtime_error("Received invalid stream data from CTA Frontend.");
}
......@@ -233,16 +233,16 @@ void CtaAdminCmd::send() const
// Print streaming response header
if(!isJson()) switch(response.show_header()) {
case HeaderType::ARCHIVEFILE_LS: formattedText.printAfLsHeader(); break;
case HeaderType::ARCHIVEFILE_LS_SUMMARY: TextFormatter::printAfLsSummaryHeader(); break;
case HeaderType::FAILEDREQUEST_LS: TextFormatter::printFrLsHeader(); break;
case HeaderType::FAILEDREQUEST_LS_SUMMARY: TextFormatter::printFrLsSummaryHeader(); break;
case HeaderType::LISTPENDINGARCHIVES: TextFormatter::printLpaHeader(); break;
case HeaderType::LISTPENDINGARCHIVES_SUMMARY: TextFormatter::printLpaSummaryHeader(); break;
case HeaderType::LISTPENDINGRETRIEVES: TextFormatter::printLprHeader(); break;
case HeaderType::LISTPENDINGRETRIEVES_SUMMARY: TextFormatter::printLprSummaryHeader(); break;
case HeaderType::TAPEPOOL_LS: TextFormatter::printTpLsHeader(); break;
case HeaderType::TAPE_LS: TextFormatter::printTapeLsHeader(); break;
case HeaderType::REPACK_LS: TextFormatter::printRepackLsHeader(); break;
case HeaderType::ARCHIVEFILE_LS_SUMMARY: formattedText.printAfLsSummaryHeader(); break;
case HeaderType::FAILEDREQUEST_LS: formattedText.printFrLsHeader(); break;
case HeaderType::FAILEDREQUEST_LS_SUMMARY: formattedText.printFrLsSummaryHeader(); break;
case HeaderType::LISTPENDINGARCHIVES: formattedText.printLpaHeader(); break;
case HeaderType::LISTPENDINGARCHIVES_SUMMARY: formattedText.printLpaSummaryHeader(); break;
case HeaderType::LISTPENDINGRETRIEVES: formattedText.printLprHeader(); break;
case HeaderType::LISTPENDINGRETRIEVES_SUMMARY: formattedText.printLprSummaryHeader(); break;
case HeaderType::TAPEPOOL_LS: formattedText.printTapePoolLsHeader(); break;
case HeaderType::TAPE_LS: formattedText.printTapeLsHeader(); break;
case HeaderType::REPACK_LS: formattedText.printRepackLsHeader(); break;
case HeaderType::NONE:
default: break;
}
......
This diff is collapsed.
......@@ -45,29 +45,29 @@ public:
// Output headers
void printAfLsHeader();
static void printAfLsSummaryHeader();
static void printFrLsHeader();
static void printFrLsSummaryHeader();
static void printLpaHeader();
static void printLpaSummaryHeader();
static void printLprHeader();
static void printLprSummaryHeader();
static void printTpLsHeader();
static void printTapeLsHeader();
static void printRepackLsHeader();
void printAfLsSummaryHeader();
void printFrLsHeader();
void printFrLsSummaryHeader();
void printLpaHeader();
void printLpaSummaryHeader();
void printLprHeader();
void printLprSummaryHeader();
void printTapePoolLsHeader();
void printTapeLsHeader();
void printRepackLsHeader();
// Output records
void print(const ArchiveFileLsItem &afls_item);
static void print(const ArchiveFileLsSummary &afls_summary);
static void print(const FailedRequestLsItem &frls_item);
static void print(const FailedRequestLsSummary &frls_summary);
static void print(const ListPendingArchivesItem &lpa_item);
static void print(const ListPendingArchivesSummary &lpa_summary);
static void print(const ListPendingRetrievesItem &lpr_item);
static void print(const ListPendingRetrievesSummary &lpr_summary);
static void print(const TapePoolLsItem &tpls_item);
static void print(const TapeLsItem &tals_item);
static void print(const RepackLsItem &rels_item);
void print(const ArchiveFileLsSummary &afls_summary);
void print(const FailedRequestLsItem &frls_item);
void print(const FailedRequestLsSummary &frls_summary);
void print(const ListPendingArchivesItem &lpa_item);
void print(const ListPendingArchivesSummary &lpa_summary);
void print(const ListPendingRetrievesItem &lpr_item);
void print(const ListPendingRetrievesSummary &lpr_summary);
void print(const TapePoolLsItem &tpls_item);
void print(const TapeLsItem &tals_item);
void print(const RepackLsItem &rels_item);
private:
//! Add a line to the buffer
......@@ -79,14 +79,14 @@ private:
if(m_outputBuffer.size() >= m_bufLines) flush();
}
//! Recursive variadic function to build a log string from an arbitrary number of items of arbitrary type
//! Recursive variadic method to build a log string from an arbitrary number of items of arbitrary type
template<typename T, typename... Args>
void buildVector(std::vector<std::string> &line, const T &item, Args... args) {
buildVector(line, item);
buildVector(line, args...);
}
//! Base case function to add one item to the log
//! Base case method to add one item to the log, with specialisations by type
template<typename T>
void buildVector(std::vector<std::string> &line, const T &item) {
line.push_back(std::to_string(item));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment