From 89c1cefbf30db6ff74ec3e83c2786bb989932f5e Mon Sep 17 00:00:00 2001 From: Steven Murray <Steven.Murray@cern.ch> Date: Tue, 6 Feb 2018 14:23:22 +0100 Subject: [PATCH] Revert "Revert "Made Catalogue a pure interface (removed m_log)"" This reverts commit fc001693dd745f99bba01bd87629c0da7827133f. The CI was incorrectly failing. There was nothing wrong with the original commit that made the Catalogue class a pure interface. --- catalogue/Catalogue.cpp | 6 ------ catalogue/Catalogue.hpp | 13 ------------- catalogue/DummyCatalogue.hpp | 2 +- catalogue/RdbmsCatalogue.cpp | 2 +- catalogue/RdbmsCatalogue.hpp | 5 +++++ objectstore/GarbageCollectorTest.cpp | 12 ++++++------ scheduler/OStoreDB/OStoreDBFactory.hpp | 4 ++-- 7 files changed, 15 insertions(+), 29 deletions(-) diff --git a/catalogue/Catalogue.cpp b/catalogue/Catalogue.cpp index b958c14715..a0866c30ba 100644 --- a/catalogue/Catalogue.cpp +++ b/catalogue/Catalogue.cpp @@ -21,12 +21,6 @@ namespace cta { namespace catalogue { -//------------------------------------------------------------------------------ -// constructor -//------------------------------------------------------------------------------ -Catalogue::Catalogue(log::Logger &log): m_log(log) { -} - //------------------------------------------------------------------------------ // destructor //------------------------------------------------------------------------------ diff --git a/catalogue/Catalogue.hpp b/catalogue/Catalogue.hpp index 790551652d..49502f9577 100644 --- a/catalogue/Catalogue.hpp +++ b/catalogue/Catalogue.hpp @@ -77,12 +77,6 @@ namespace catalogue { */ class Catalogue { public: - /** - * Constructor. - * - * @param log Object representing the API to the CTA logging system. - */ - Catalogue(log::Logger &log); /** * Destructor. @@ -586,13 +580,6 @@ public: */ virtual bool tapeExists(const std::string &vid) const = 0; -protected: - - /** - * Object representing the API to the CTA logging system. - */ - log::Logger &m_log; - }; // class Catalogue } // namespace catalogue diff --git a/catalogue/DummyCatalogue.hpp b/catalogue/DummyCatalogue.hpp index 1e84cf92ad..008c80c328 100644 --- a/catalogue/DummyCatalogue.hpp +++ b/catalogue/DummyCatalogue.hpp @@ -31,7 +31,7 @@ namespace catalogue { */ class DummyCatalogue: public Catalogue { public: - DummyCatalogue(log::Logger &l): Catalogue(l) {} + DummyCatalogue() {} virtual ~DummyCatalogue() { } void createAdminHost(const common::dataStructures::SecurityIdentity& admin, const std::string& hostName, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } diff --git a/catalogue/RdbmsCatalogue.cpp b/catalogue/RdbmsCatalogue.cpp index 2e4f3b6131..cdea6a3a30 100644 --- a/catalogue/RdbmsCatalogue.cpp +++ b/catalogue/RdbmsCatalogue.cpp @@ -47,7 +47,7 @@ RdbmsCatalogue::RdbmsCatalogue( const uint64_t nbConns, const uint64_t nbArchiveFileListingConns, const uint32_t maxTriesToConnect): - Catalogue(log), + m_log(log), m_connPool(login, nbConns), m_archiveFileListingConnPool(login, nbArchiveFileListingConns), m_maxTriesToConnect(maxTriesToConnect) { diff --git a/catalogue/RdbmsCatalogue.hpp b/catalogue/RdbmsCatalogue.hpp index 2b57b7fb85..d15b4dfefd 100644 --- a/catalogue/RdbmsCatalogue.hpp +++ b/catalogue/RdbmsCatalogue.hpp @@ -534,6 +534,11 @@ public: protected: + /** + * Object representing the API to the CTA logging system. + */ + log::Logger &m_log; + /** * Mutex to be used to a take a global lock on the database. */ diff --git a/objectstore/GarbageCollectorTest.cpp b/objectstore/GarbageCollectorTest.cpp index 092df08f8e..68d51ed8b4 100644 --- a/objectstore/GarbageCollectorTest.cpp +++ b/objectstore/GarbageCollectorTest.cpp @@ -44,7 +44,7 @@ namespace unitTests { TEST(ObjectStore, GarbageCollectorBasicFuctionnality) { // We will need a log object cta::log::DummyLogger dl("unitTest"); - cta::catalogue::DummyCatalogue catalogue(dl); + cta::catalogue::DummyCatalogue catalogue; cta::log::LogContext lc(dl); // Here we check for the ability to detect dead (but empty agents) // and clean them up. @@ -98,7 +98,7 @@ TEST(ObjectStore, GarbageCollectorRegister) { // We will need a log object cta::log::DummyLogger dl("unitTest"); cta::log::LogContext lc(dl); - cta::catalogue::DummyCatalogue catalogue(dl); + cta::catalogue::DummyCatalogue catalogue; // Here we check that can successfully call agentRegister's garbage collector cta::objectstore::BackendVFS be; cta::objectstore::AgentReference agentRef("unitTestGarbageCollector", dl); @@ -158,7 +158,7 @@ TEST(ObjectStore, GarbageCollectorArchiveQueue) { cta::log::DummyLogger dl("unitTest"); cta::log::LogContext lc(dl); // We need a dummy catalogue - cta::catalogue::DummyCatalogue catalogue(dl); + cta::catalogue::DummyCatalogue catalogue; // Here we check that can successfully call agentRegister's garbage collector cta::objectstore::BackendVFS be; cta::objectstore::AgentReference agentRef("unitTestGarbageCollector", dl); @@ -218,7 +218,7 @@ TEST(ObjectStore, GarbageCollectorDriveRegister) { cta::log::DummyLogger dl("unitTest"); cta::log::LogContext lc(dl); // We need a dummy catalogue - cta::catalogue::DummyCatalogue catalogue(dl); + cta::catalogue::DummyCatalogue catalogue; // Here we check that can successfully call agentRegister's garbage collector cta::objectstore::BackendVFS be; cta::objectstore::AgentReference agentRef("unitTestGarbageCollector", dl); @@ -282,7 +282,7 @@ TEST(ObjectStore, GarbageCollectorArchiveRequest) { #endif cta::log::LogContext lc(dl); // We need a dummy catalogue - cta::catalogue::DummyCatalogue catalogue(dl); + cta::catalogue::DummyCatalogue catalogue; // Here we check that can successfully call ArchiveRequests's garbage collector cta::objectstore::BackendVFS be; // Create the root entry @@ -480,7 +480,7 @@ TEST(ObjectStore, GarbageCollectorRetrieveRequest) { #endif cta::log::LogContext lc(dl); // We need a dummy catalogue - cta::catalogue::DummyCatalogue catalogue(dl); + cta::catalogue::DummyCatalogue catalogue; // Here we check that can successfully call RetrieveRequests's garbage collector cta::objectstore::BackendVFS be; // Create the root entry diff --git a/scheduler/OStoreDB/OStoreDBFactory.hpp b/scheduler/OStoreDB/OStoreDBFactory.hpp index 6aeb7f25e3..6080c3be9e 100644 --- a/scheduler/OStoreDB/OStoreDBFactory.hpp +++ b/scheduler/OStoreDB/OStoreDBFactory.hpp @@ -171,7 +171,7 @@ template <> OStoreDBWrapper<cta::objectstore::BackendVFS>::OStoreDBWrapper( const std::string &context, const std::string &URL) : m_logger(new cta::log::DummyLogger("")), m_backend(new cta::objectstore::BackendVFS()), -m_catalogue(new cta::catalogue::DummyCatalogue(*m_logger)), +m_catalogue(new cta::catalogue::DummyCatalogue), m_OStoreDB(*m_backend, *m_catalogue, *m_logger), m_agentReference("OStoreDBFactory", *m_logger) { // We need to populate the root entry before using. objectstore::RootEntry re(*m_backend); @@ -198,7 +198,7 @@ template <> OStoreDBWrapper<cta::objectstore::BackendRados>::OStoreDBWrapper( const std::string &context, const std::string &URL) : m_logger(new cta::log::DummyLogger("")), m_backend(cta::objectstore::BackendFactory::createBackend(URL, *m_logger).release()), -m_catalogue(new cta::catalogue::DummyCatalogue(*m_logger)), +m_catalogue(new cta::catalogue::DummyCatalogue), m_OStoreDB(*m_backend, *m_catalogue, *m_logger), m_agentReference("OStoreDBFactory", *m_logger) { // We need to first clean up possible left overs in the pool auto l = m_backend->list(); -- GitLab