From de5b0cdd4d8c9118a641f571c80c4ec863b88965 Mon Sep 17 00:00:00 2001 From: Anastasia Karachaliou <anastasia.karachaliou@cern.ch> Date: Mon, 9 Apr 2018 18:26:00 +0200 Subject: [PATCH] Correction of the namespace in SourcedParameter --- common/SourcedParameter.cpp | 4 +-- common/SourcedParameter.hpp | 4 +-- common/SourcedParameterTests.cpp | 2 +- tapeserver/daemon/TapedConfiguration.cpp | 12 ++++--- tapeserver/daemon/TapedConfiguration.hpp | 36 +++++++++---------- tapeserver/daemon/TapedConfigurationTests.cpp | 2 +- tapeserver/daemon/Tpconfig.hpp | 2 +- 7 files changed, 30 insertions(+), 32 deletions(-) diff --git a/common/SourcedParameter.cpp b/common/SourcedParameter.cpp index 59229040e6..f650eb4cec 100644 --- a/common/SourcedParameter.cpp +++ b/common/SourcedParameter.cpp @@ -22,8 +22,6 @@ namespace cta { -namespace tape { -namespace daemon { template<> void SourcedParameter<time_t>::set(const std::string & value, const std::string & source) { @@ -75,4 +73,4 @@ void SourcedParameter<std::string>::addLogParamForValue(log::LogContext & lc) { lc.pushOrReplace({"value", m_value}); } -}}} // namespace cta::tape::daemon +} // namespace cta diff --git a/common/SourcedParameter.hpp b/common/SourcedParameter.hpp index 3d38550402..f729c54004 100644 --- a/common/SourcedParameter.hpp +++ b/common/SourcedParameter.hpp @@ -27,8 +27,6 @@ namespace cta { -namespace tape { -namespace daemon { /** * A templated class allowing the tracking of parameter with their source. * If the parameter is not set (implicitly defined as the source being @@ -115,4 +113,4 @@ private: -}}} // namespace cta::tape::daemon +} // namespace cta diff --git a/common/SourcedParameterTests.cpp b/common/SourcedParameterTests.cpp index 24af579949..be36ce78c1 100644 --- a/common/SourcedParameterTests.cpp +++ b/common/SourcedParameterTests.cpp @@ -24,7 +24,7 @@ namespace unitTests { TEST(cta_Daemon, SourcedParameter) { - cta::tape::daemon::SourcedParameter<cta::tape::daemon::FetchReportOrFlushLimits> mountCriteria("unitTest", "mountCriteria"); + cta::SourcedParameter<cta::tape::daemon::FetchReportOrFlushLimits> mountCriteria("unitTest", "mountCriteria"); mountCriteria.set("12, 34", "Unit test"); ASSERT_EQ(12, mountCriteria.value().maxBytes); ASSERT_EQ(34, mountCriteria.value().maxFiles); diff --git a/tapeserver/daemon/TapedConfiguration.cpp b/tapeserver/daemon/TapedConfiguration.cpp index 55f4abbce6..cda5c2ba9a 100644 --- a/tapeserver/daemon/TapedConfiguration.cpp +++ b/tapeserver/daemon/TapedConfiguration.cpp @@ -22,13 +22,12 @@ #include <algorithm> -namespace cta { namespace tape { namespace daemon { - +namespace cta { //------------------------------------------------------------------------------ // addLogParamForValue //------------------------------------------------------------------------------ template<> -void SourcedParameter<TpconfigLine>::addLogParamForValue(log::LogContext & lc) { +void SourcedParameter<tape::daemon::TpconfigLine>::addLogParamForValue(log::LogContext & lc) { lc.pushOrReplace({"category", "TPCONFIG Entry"}); lc.pushOrReplace({"unitName", m_value.unitName}); lc.pushOrReplace({"logicalLibrary", m_value.logicalLibrary}); @@ -40,7 +39,7 @@ void SourcedParameter<TpconfigLine>::addLogParamForValue(log::LogContext & lc) { // addLogParamForValue //------------------------------------------------------------------------------ template<> -void SourcedParameter<FetchReportOrFlushLimits>::addLogParamForValue(log::LogContext & lc) { +void SourcedParameter<tape::daemon::FetchReportOrFlushLimits>::addLogParamForValue(log::LogContext & lc) { lc.pushOrReplace({"maxBytes", m_value.maxBytes}); lc.pushOrReplace({"maxFiles", m_value.maxFiles}); } @@ -49,7 +48,7 @@ void SourcedParameter<FetchReportOrFlushLimits>::addLogParamForValue(log::LogCon // set //------------------------------------------------------------------------------ template<> -void SourcedParameter<FetchReportOrFlushLimits>::set(const std::string & value, +void SourcedParameter<tape::daemon::FetchReportOrFlushLimits>::set(const std::string & value, const std::string & source) { // We expect an entry in the form "<size limit>, <file limit>" // There should be one and only one comma in the parameter. @@ -79,6 +78,9 @@ void SourcedParameter<FetchReportOrFlushLimits>::set(const std::string & value, m_source = source; m_set = true; } +} + +namespace cta { namespace tape { namespace daemon { //------------------------------------------------------------------------------ // GlobalConfiguration::createFromCtaConf w path diff --git a/tapeserver/daemon/TapedConfiguration.hpp b/tapeserver/daemon/TapedConfiguration.hpp index 80d259dca1..a40d6d343e 100644 --- a/tapeserver/daemon/TapedConfiguration.hpp +++ b/tapeserver/daemon/TapedConfiguration.hpp @@ -45,16 +45,16 @@ struct TapedConfiguration { // Basics: tp config //---------------------------------------------------------------------------- /// The user name of the cta-taped daemon process - SourcedParameter<std::string> daemonUserName{ + cta::SourcedParameter<std::string> daemonUserName{ "taped", "DaemonUserName", "cta", "Compile time default"}; /// The group name of the cta-taped daemon process - SourcedParameter<std::string> daemonGroupName{ + cta::SourcedParameter<std::string> daemonGroupName{ "taped", "DaemonGroupName", "tape", "Compile time default"}; /// The log mask. Logs with a level lower than this value will be masked. - SourcedParameter<std::string> logMask{ + cta::SourcedParameter<std::string> logMask{ "taped", "LogMask", "DEBUG", "Compile time default"}; /// Path to the file describing the tape drives (TPCONFIG) - SourcedParameter<std::string> tpConfigPath{ + cta::SourcedParameter<std::string> tpConfigPath{ "taped" , "TpConfigPath", "/etc/cta/TPCONFIG", "Compile time default"}; /// Extracted drives configuration. Tpconfig driveConfigs; @@ -62,63 +62,63 @@ struct TapedConfiguration { // Memory management //---------------------------------------------------------------------------- /// Memory buffer size in bytes (with a default of 5MB). TODO-switch to 32MB once validated in CASTOR. - SourcedParameter<uint64_t> bufferSizeBytes{ + cta::SourcedParameter<uint64_t> bufferSizeBytes{ "taped", "BufferSizeBytes", 5*1024*1024, "Compile time default"}; /// Memory buffer count per drive. There is no default to this one. - SourcedParameter<uint64_t> bufferCount{ + cta::SourcedParameter<uint64_t> bufferCount{ "taped", "BufferCount"}; //---------------------------------------------------------------------------- // Batched metadata access and tape write flush parameters //---------------------------------------------------------------------------- /// The fetch size for archive requests - SourcedParameter<FetchReportOrFlushLimits> archiveFetchBytesFiles{ + cta::SourcedParameter<FetchReportOrFlushLimits> archiveFetchBytesFiles{ "taped", "ArchiveFetchBytesFiles", {80L*1000*1000*1000, 500}, "Compile time default"}; /// The flush to tape criteria for archiving - SourcedParameter<FetchReportOrFlushLimits> archiveFlushBytesFiles{ + cta::SourcedParameter<FetchReportOrFlushLimits> archiveFlushBytesFiles{ "taped", "ArchiveFlushBytesFiles", {32L*1000*1000*1000, 200}, "Compile time default"}; /// The fetch and report size for retrieve requests - SourcedParameter<FetchReportOrFlushLimits> retrieveFetchBytesFiles{ + cta::SourcedParameter<FetchReportOrFlushLimits> retrieveFetchBytesFiles{ "taped", "RetrieveFetchBytesFiles", {80L*1000*1000*1000, 500}, "Compile time default"}; //---------------------------------------------------------------------------- // Scheduling limits //---------------------------------------------------------------------------- - SourcedParameter<FetchReportOrFlushLimits> mountCriteria{ + cta::SourcedParameter<FetchReportOrFlushLimits> mountCriteria{ "taped", "MountCriteria", {80L*1000*1000*1000, 500}, "Compile time default"}; //---------------------------------------------------------------------------- // Disk file access parameters //---------------------------------------------------------------------------- /// Number of disk threads. This is the number of parallel file transfers. - SourcedParameter<uint64_t> nbDiskThreads{ + cta::SourcedParameter<uint64_t> nbDiskThreads{ "taped", "NbDiskThreads", 10, "Compile time default"}; //---------------------------------------------------------------------------- // Recommended Access Order usage //---------------------------------------------------------------------------- /// Usage of Recommended Access Order for file recall - SourcedParameter<std::string> useRAO{ + cta::SourcedParameter<std::string> useRAO{ "taped", "UseRAO", "no", "Compile time default"}; //---------------------------------------------------------------------------- // Watchdog: parameters for timeouts in various situations. //---------------------------------------------------------------------------- /// Maximum time allowed to complete a single mount scheduling. - SourcedParameter<time_t> wdScheduleMaxSecs{ + cta::SourcedParameter<time_t> wdScheduleMaxSecs{ "taped", "WatchdogScheduleMaxSecs", 60, "Compile time default"}; /// Maximum time allowed to complete mount a tape. - SourcedParameter<time_t> wdMountMaxSecs{ + cta::SourcedParameter<time_t> wdMountMaxSecs{ "taped", "WatchdogMountMaxSecs", 900, "Compile time default"}; /// Maximum time allowed after mounting without a single tape block move - SourcedParameter<time_t> wdNoBlockMoveMaxSecs{ + cta::SourcedParameter<time_t> wdNoBlockMoveMaxSecs{ "taped", "WatchdogNoBlockMoveMaxSecs", 1800, "Compile time default"}; /// Time to wait after scheduling came up idle - SourcedParameter<time_t> wdIdleSessionTimer{ + cta::SourcedParameter<time_t> wdIdleSessionTimer{ "taped", "WatchdogIdleSessionTimer", 10, "Compile time default"}; //---------------------------------------------------------------------------- // The central storage access configuration //---------------------------------------------------------------------------- /// URL of the object store. - SourcedParameter<std::string> backendPath{ + cta::SourcedParameter<std::string> backendPath{ "ObjectStore", "BackendPath"}; /// Path to the file catalog config file - SourcedParameter<std::string> fileCatalogConfigFile{ + cta::SourcedParameter<std::string> fileCatalogConfigFile{ "general", "FileCatalogConfigFile", "/etc/cta/cta-catalogue.conf", "Compile time default"}; private: diff --git a/tapeserver/daemon/TapedConfigurationTests.cpp b/tapeserver/daemon/TapedConfigurationTests.cpp index fe0c95e5a8..43f57da5d1 100644 --- a/tapeserver/daemon/TapedConfigurationTests.cpp +++ b/tapeserver/daemon/TapedConfigurationTests.cpp @@ -39,7 +39,7 @@ TEST(cta_Daemon, TapedConfiguration) { TempFile emptyTpConfig; completeConfFile.stringAppend(emptyTpConfig.path()); ASSERT_THROW(cta::tape::daemon::TapedConfiguration::createFromCtaConf(incompleteConfFile.path()), - cta::tape::daemon::SourcedParameter<uint64_t>::MandatoryParameterNotDefined); + cta::SourcedParameter<uint64_t>::MandatoryParameterNotDefined); auto completeConfig = cta::tape::daemon::TapedConfiguration::createFromCtaConf(completeConfFile.path()); ASSERT_EQ(completeConfFile.path()+":2", completeConfig.backendPath.source()); diff --git a/tapeserver/daemon/Tpconfig.hpp b/tapeserver/daemon/Tpconfig.hpp index 00bb2c626e..e637abd5f2 100644 --- a/tapeserver/daemon/Tpconfig.hpp +++ b/tapeserver/daemon/Tpconfig.hpp @@ -29,7 +29,7 @@ namespace cta { namespace tape { namespace daemon { /** * A map of lines parsed from a TPCONFIG file (key is the drive name) */ -class Tpconfig: public std::map<std::string, SourcedParameter<TpconfigLine>> { +class Tpconfig: public std::map<std::string, cta::SourcedParameter<TpconfigLine>> { public: CTA_GENERATE_EXCEPTION_CLASS(InvalidArgument); -- GitLab