From f0e25537b92f63cb88d838fe0275ef1b566eb193 Mon Sep 17 00:00:00 2001 From: Michael Davis <michael.davis@cern.ch> Date: Mon, 2 Oct 2017 11:58:02 +0200 Subject: [PATCH] [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. --- xroot_plugins/ListArchiveFilesCmd.cpp | 2 -- xroot_plugins/ListArchiveFilesCmd.hpp | 6 ------ xroot_plugins/XrdCtaFile.cpp | 2 +- xroot_plugins/XrdSsiCtaRequestMessage.cpp | 8 ++++---- xroot_plugins/XrdSsiCtaRequestMessage.hpp | 16 +++++++++------- 5 files changed, 14 insertions(+), 20 deletions(-) diff --git a/xroot_plugins/ListArchiveFilesCmd.cpp b/xroot_plugins/ListArchiveFilesCmd.cpp index 35206a722f..c8064a38f9 100644 --- a/xroot_plugins/ListArchiveFilesCmd.cpp +++ b/xroot_plugins/ListArchiveFilesCmd.cpp @@ -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)) { diff --git a/xroot_plugins/ListArchiveFilesCmd.hpp b/xroot_plugins/ListArchiveFilesCmd.hpp index 50c9d69483..fd5993154e 100644 --- a/xroot_plugins/ListArchiveFilesCmd.hpp +++ b/xroot_plugins/ListArchiveFilesCmd.hpp @@ -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. */ diff --git a/xroot_plugins/XrdCtaFile.cpp b/xroot_plugins/XrdCtaFile.cpp index c457a7d1fa..d0882e0d96 100644 --- a/xroot_plugins/XrdCtaFile.cpp +++ b/xroot_plugins/XrdCtaFile.cpp @@ -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()) { diff --git a/xroot_plugins/XrdSsiCtaRequestMessage.cpp b/xroot_plugins/XrdSsiCtaRequestMessage.cpp index 7a611e0138..1fa0f75d80 100644 --- a/xroot_plugins/XrdSsiCtaRequestMessage.cpp +++ b/xroot_plugins/XrdSsiCtaRequestMessage.cpp @@ -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()); diff --git a/xroot_plugins/XrdSsiCtaRequestMessage.hpp b/xroot_plugins/XrdSsiCtaRequestMessage.hpp index bf4473aa4e..a658f64dc0 100644 --- a/xroot_plugins/XrdSsiCtaRequestMessage.hpp +++ b/xroot_plugins/XrdSsiCtaRequestMessage.hpp @@ -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 -- GitLab