Commit 0273ee72 authored by Michael Davis's avatar Michael Davis
Browse files

[cta_frontend] Integrates cta_admin af ls command

This is a first version of the command which has a fixed-size return buffer,
this code still needs to be refactored to allow a result of arbitrary size.

Removes the log parameter from ListArchiveFilesCmd constructor. Elsewhere we
are using log context objects: the SSI version of the command dispatcher has
access to the lc but not the log object. In any case this was not being used
so safe to remove for the time being.
parent bab6d64f
......@@ -29,11 +29,9 @@ namespace xrootPlugins {
// constructor
//------------------------------------------------------------------------------
ListArchiveFilesCmd::ListArchiveFilesCmd(
log::Logger &log,
XrdOucErrInfo &xrdSfsFileError,
const bool displayHeader,
catalogue::ArchiveFileItor archiveFileItor):
m_log(log),
m_xrdSfsFileError(xrdSfsFileError),
m_displayHeader(displayHeader),
m_archiveFileItor(std::move(archiveFileItor)) {
......
......@@ -45,7 +45,6 @@ public:
* @param archiveFileItor Iterator over the archive files in the CTA catalogue that are to be listed.
*/
ListArchiveFilesCmd(
log::Logger &log,
XrdOucErrInfo &xrdSfsFileError,
const bool displayHeader,
catalogue::ArchiveFileItor archiveFileItor);
......@@ -57,11 +56,6 @@ public:
protected:
/**
* The object representing the API of the CTA logging system.
*/
log::Logger &m_log;
/**
* The error member-variable of the XrdSfsFile class.
*/
......
......@@ -1678,7 +1678,7 @@ std::string XrdCtaFile::xCom_archivefile() {
if(!summary) {
const bool displayHeader = hasOption("-h", "--header");
auto archiveFileItor = m_catalogue->getArchiveFiles(searchCriteria);
m_listArchiveFilesCmd.reset(new ListArchiveFilesCmd(m_log, error, displayHeader, std::move(archiveFileItor)));
m_listArchiveFilesCmd.reset(new ListArchiveFilesCmd(error, displayHeader, std::move(archiveFileItor)));
/*
std::unique_ptr<cta::catalogue::ArchiveFileItor> itor = m_catalogue->getArchiveFileItor(searchCriteria);
if(itor->hasMore()) {
......
......@@ -621,10 +621,10 @@ void RequestMessage::processArchiveFile_Ls(const cta::admin::AdminCmd &admincmd,
cmdlineOutput << formatResponse(responseTable);
} else {
auto archiveFileItor = m_catalogue.getArchiveFiles(searchCriteria);
#if 0
// TO DO: Implement list archive files
m_listArchiveFilesCmd.reset(new xrootPlugins::ListArchiveFilesCmd(m_log, error, has_flag(OptionBoolean::SHOW_HEADER), std::move(archiveFileItor)));
#endif
XrdOucErrInfo xrdSfsFileError;
m_listArchiveFilesCmd.reset(new xrootPlugins::ListArchiveFilesCmd(xrdSfsFileError, has_flag(OptionBoolean::SHOW_HEADER), std::move(archiveFileItor)));
}
response.set_message_txt(cmdlineOutput.str());
......
......@@ -20,6 +20,7 @@
#include <XrdSsi/XrdSsiEntity.hh>
#include "ListArchiveFilesCmd.hpp"
#include "XrdSsiCtaServiceProvider.hpp"
#include "xroot_plugins/messages/cta_frontend.pb.h"
......@@ -247,13 +248,14 @@ private:
// Member variables
cta::catalogue::Catalogue &m_catalogue; //!< Reference to CTA Catalogue
cta::Scheduler &m_scheduler; //!< Reference to CTA Scheduler
cta::log::LogContext m_lc; //!< CTA Log Context
cta::common::dataStructures::SecurityIdentity m_cliIdentity; //!< The client identity info: username and host
std::map<cta::admin::OptionBoolean::Key, bool> m_option_bool; //!< Boolean options
std::map<cta::admin::OptionUInt64::Key, uint64_t> m_option_uint64; //!< UInt64 options
std::map<cta::admin::OptionString::Key, std::string> m_option_str; //!< String options
cta::catalogue::Catalogue &m_catalogue; //!< Reference to CTA Catalogue
cta::Scheduler &m_scheduler; //!< Reference to CTA Scheduler
cta::log::LogContext m_lc; //!< CTA Log Context
cta::common::dataStructures::SecurityIdentity m_cliIdentity; //!< The client identity info: username and host
std::map<cta::admin::OptionBoolean::Key, bool> m_option_bool; //!< Boolean options
std::map<cta::admin::OptionUInt64::Key, uint64_t> m_option_uint64; //!< UInt64 options
std::map<cta::admin::OptionString::Key, std::string> m_option_str; //!< String options
std::unique_ptr<cta::xrootPlugins::ListArchiveFilesCmd> m_listArchiveFilesCmd; //!< List archive files command
};
}} // namespace cta::xrd
......
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