diff --git a/catalogue/Catalogue.hpp b/catalogue/Catalogue.hpp index 7b57fa5bb4cce89672fde3454c45193c98c69547..dc8f3d61048c26fc0eae851c7a8877acde356f8a 100644 --- a/catalogue/Catalogue.hpp +++ b/catalogue/Catalogue.hpp @@ -335,12 +335,12 @@ public: virtual void modifyMountPolicyComment(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &comment) = 0; virtual void createDedication(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const common::dataStructures::DedicationType dedicationType, - const std::string &tag, const std::string &vid, const uint64_t fromTimestamp, const uint64_t untilTimestamp,const std::string &comment) = 0; + const optional<std::string> &tag, const optional<std::string> &vid, const uint64_t fromTimestamp, const uint64_t untilTimestamp,const std::string &comment) = 0; virtual void deleteDedication(const std::string &drivename) = 0; virtual std::list<common::dataStructures::Dedication> getDedications() const = 0; virtual void modifyDedicationType(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const common::dataStructures::DedicationType dedicationType) = 0; - virtual void modifyDedicationTag(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const std::string &tag) = 0; - virtual void modifyDedicationVid(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const std::string &vid) = 0; + virtual void modifyDedicationTag(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const optional<std::string> &tag) = 0; + virtual void modifyDedicationVid(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const optional<std::string> &vid) = 0; virtual void modifyDedicationFrom(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const uint64_t fromTimestamp) = 0; virtual void modifyDedicationUntil(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const uint64_t untilTimestamp) = 0; virtual void modifyDedicationComment(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const std::string &comment) = 0; diff --git a/catalogue/RdbmsCatalogue.cpp b/catalogue/RdbmsCatalogue.cpp index 1f74601d807c5ea23064631308cbfec58de07e72..978291ee4c13043f59c5ce42649a0be6814b0336 100644 --- a/catalogue/RdbmsCatalogue.cpp +++ b/catalogue/RdbmsCatalogue.cpp @@ -2371,7 +2371,7 @@ void RdbmsCatalogue::modifyMountPolicyComment(const common::dataStructures::Secu // createDedication //------------------------------------------------------------------------------ void RdbmsCatalogue::createDedication(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const common::dataStructures::DedicationType dedicationType, - const std::string &tag, const std::string &vid, const uint64_t fromTimestamp, const uint64_t untilTimestamp,const std::string &comment) { + const optional<std::string> &tag, const optional<std::string> &vid, const uint64_t fromTimestamp, const uint64_t untilTimestamp,const std::string &comment) { throw exception::Exception(std::string(__FUNCTION__) + " not implemented"); } @@ -2399,14 +2399,14 @@ void RdbmsCatalogue::modifyDedicationType(const common::dataStructures::Security //------------------------------------------------------------------------------ // modifyDedicationTag //------------------------------------------------------------------------------ -void RdbmsCatalogue::modifyDedicationTag(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const std::string &tag) { +void RdbmsCatalogue::modifyDedicationTag(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const optional<std::string> &tag) { throw exception::Exception(std::string(__FUNCTION__) + " not implemented"); } //------------------------------------------------------------------------------ // modifyDedicationVid //------------------------------------------------------------------------------ -void RdbmsCatalogue::modifyDedicationVid(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const std::string &vid) { +void RdbmsCatalogue::modifyDedicationVid(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const optional<std::string> &vid) { throw exception::Exception(std::string(__FUNCTION__) + " not implemented"); } diff --git a/catalogue/RdbmsCatalogue.hpp b/catalogue/RdbmsCatalogue.hpp index a293f8d86252afc3c55deb8224fa0c2ed0bf34e6..7a48151c171d7b961f42d4aab2e895dddb334dad 100644 --- a/catalogue/RdbmsCatalogue.hpp +++ b/catalogue/RdbmsCatalogue.hpp @@ -323,12 +323,12 @@ public: virtual void modifyMountPolicyComment(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &comment) override; virtual void createDedication(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const common::dataStructures::DedicationType dedicationType, - const std::string &tag, const std::string &vid, const uint64_t fromTimestamp, const uint64_t untilTimestamp,const std::string &comment) override; + const optional<std::string> &tag, const optional<std::string> &vid, const uint64_t fromTimestamp, const uint64_t untilTimestamp,const std::string &comment) override; virtual void deleteDedication(const std::string &drivename) override; virtual std::list<common::dataStructures::Dedication> getDedications() const override; virtual void modifyDedicationType(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const common::dataStructures::DedicationType dedicationType) override; - virtual void modifyDedicationTag(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const std::string &tag) override; - virtual void modifyDedicationVid(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const std::string &vid) override; + virtual void modifyDedicationTag(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const optional<std::string> &tag) override; + virtual void modifyDedicationVid(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const optional<std::string> &vid) override; virtual void modifyDedicationFrom(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const uint64_t fromTimestamp) override; virtual void modifyDedicationUntil(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const uint64_t untilTimestamp) override; virtual void modifyDedicationComment(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &drivename, const std::string &comment) override; diff --git a/scheduler/Scheduler.cpp b/scheduler/Scheduler.cpp index 75730d5471f59b5abe306cdeb0655dbce7347e59..dcb881eaef30b0864f277e9b046fea77cd57f7b3 100644 --- a/scheduler/Scheduler.cpp +++ b/scheduler/Scheduler.cpp @@ -167,7 +167,7 @@ std::list<cta::common::dataStructures::StorageClass> cta::Scheduler::listStorage //------------------------------------------------------------------------------ // labelTape //------------------------------------------------------------------------------ -void cta::Scheduler::labelTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool force, const bool lbp, const std::string &tag) { +void cta::Scheduler::labelTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool force, const bool lbp, const optional<std::string> &tag) { throw cta::exception::Exception(std::string("Not implemented: ") + __PRETTY_FUNCTION__); } @@ -202,7 +202,7 @@ void cta::Scheduler::setTapeLbp(const cta::common::dataStructures::SecurityIdent //------------------------------------------------------------------------------ // repack //------------------------------------------------------------------------------ -void cta::Scheduler::repack(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &tag, const cta::common::dataStructures::RepackType) { +void cta::Scheduler::repack(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const optional<std::string> &tag, const cta::common::dataStructures::RepackType) { throw cta::exception::Exception(std::string("Not implemented: ") + __PRETTY_FUNCTION__); } @@ -237,7 +237,7 @@ void cta::Scheduler::shrink(const cta::common::dataStructures::SecurityIdentity //------------------------------------------------------------------------------ // verify //------------------------------------------------------------------------------ -void cta::Scheduler::verify(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &tag, const uint64_t numberOfFiles) { +void cta::Scheduler::verify(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const optional<std::string> &tag, const optional<uint64_t> numberOfFiles) { throw cta::exception::Exception(std::string("Not implemented: ") + __PRETTY_FUNCTION__); } diff --git a/scheduler/Scheduler.hpp b/scheduler/Scheduler.hpp index 47adf30e1575e8408e4b6e463ac0334496833139..2c0710d575fd886fe7cfb8c91f26bb25c5f5b094 100644 --- a/scheduler/Scheduler.hpp +++ b/scheduler/Scheduler.hpp @@ -120,20 +120,20 @@ public: */ virtual std::list<cta::common::dataStructures::StorageClass> listStorageClass(const std::string &instanceName, const cta::common::dataStructures::ListStorageClassRequest &request); - virtual void labelTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool force, const bool lbp, const std::string &tag); + virtual void labelTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool force, const bool lbp, const optional<std::string> &tag); virtual void setTapeBusy(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool busyValue); // internal function not exposed to the Admin CLI virtual void setTapeFull(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool fullValue); virtual void setTapeDisabled(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool disabledValue); virtual void setTapeLbp(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool lbpValue); // internal function (noCLI) - virtual void repack(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &tag, const cta::common::dataStructures::RepackType); + virtual void repack(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const optional<std::string> &tag, const cta::common::dataStructures::RepackType); virtual void cancelRepack(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid); virtual std::list<cta::common::dataStructures::RepackInfo> getRepacks(const cta::common::dataStructures::SecurityIdentity &cliIdentity); virtual cta::common::dataStructures::RepackInfo getRepack(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid); virtual void shrink(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &tapepool); // removes extra tape copies from a specific pool(usually an "_2" pool) - virtual void verify(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &tag, const uint64_t numberOfFiles); //if last argument is 0, all files are verified + virtual void verify(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const optional<std::string> &tag, const optional<uint64_t> numberOfFiles); //if numberOfFiles is nullopt, all files are verified virtual void cancelVerify(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid); virtual std::list<cta::common::dataStructures::VerifyInfo> getVerifys(const cta::common::dataStructures::SecurityIdentity &cliIdentity) const; virtual cta::common::dataStructures::VerifyInfo getVerify(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid) const; diff --git a/xroot_plugins/XrdCtaFile.cpp b/xroot_plugins/XrdCtaFile.cpp index 53c1db05b95c4bcadefb5356164037aea2ca08b6..d21dad6b15a8b4ca9f33d2a288d1a062e49e1555 100644 --- a/xroot_plugins/XrdCtaFile.cpp +++ b/xroot_plugins/XrdCtaFile.cpp @@ -956,19 +956,19 @@ void XrdCtaFile::xCom_tape() { optional<std::string> logicallibrary = getOptionStringValue("-l", "--logicallibrary", false, true, false); optional<std::string> tapepool = getOptionStringValue("-t", "--tapepool", false, true, false); optional<uint64_t> capacity = getOptionUint64Value("-c", "--capacity", false, true, false); - optional<std::string> encryptionkey = getOptionStringValue("-k", "--encryptionkey", false, true, true, "-"); + optional<std::string> encryptionkey = getOptionStringValue("-k", "--encryptionkey", false, false, false); optional<std::string> comment = getOptionStringValue("-m", "--comment", false, true, true, "-"); optional<bool> disabled = getOptionBoolValue("-d", "--disabled", false, true, false); optional<bool> full = getOptionBoolValue("-f", "--full", false, true, false); checkOptions(help.str()); - m_catalogue->createTape(m_cliIdentity, vid.value(), logicallibrary.value(), tapepool.value(), encryptionkey.value(), capacity.value(), disabled.value(), full.value(), comment.value()); + m_catalogue->createTape(m_cliIdentity, vid.value(), logicallibrary.value(), tapepool.value(), encryptionkey, capacity.value(), disabled.value(), full.value(), comment.value()); } else if("ch" == m_requestTokens.at(2)) { //ch optional<std::string> logicallibrary = getOptionStringValue("-l", "--logicallibrary", false, false, false); optional<std::string> tapepool = getOptionStringValue("-t", "--tapepool", false, false, false); optional<uint64_t> capacity = getOptionUint64Value("-c", "--capacity", false, false, false); - optional<std::string> comment = getOptionStringValue("-m", "--comment", false, false, false); optional<std::string> encryptionkey = getOptionStringValue("-k", "--encryptionkey", false, false, false); + optional<std::string> comment = getOptionStringValue("-m", "--comment", false, false, false); optional<bool> disabled = getOptionBoolValue("-d", "--disabled", false, false, false); optional<bool> full = getOptionBoolValue("-f", "--full", false, false, false); checkOptions(help.str()); @@ -1000,11 +1000,11 @@ void XrdCtaFile::xCom_tape() { } else if("label" == m_requestTokens.at(2)) { //label //the tag will be set to "-" in case it's missing from the cmdline; which means no tagging - optional<std::string> tag = getOptionStringValue("-t", "--tag", false, false, true, "-"); + optional<std::string> tag = getOptionStringValue("-t", "--tag", false, false, false); optional<bool> force = getOptionBoolValue("-f", "--force", false, false, true, "false"); optional<bool> lbp = getOptionBoolValue("-l", "--lbp", false, false, true, "true"); checkOptions(help.str()); - m_scheduler->labelTape(m_cliIdentity, vid.value(), force.value(), lbp.value(), tag.value()); + m_scheduler->labelTape(m_cliIdentity, vid.value(), force.value(), lbp.value(), tag); } else { //rm checkOptions(help.str()); @@ -1398,7 +1398,7 @@ void XrdCtaFile::xCom_dedication() { else if(writeonly) { type=cta::common::dataStructures::DedicationType::writeonly; } - m_catalogue->createDedication(m_cliIdentity, drive.value(), type, tag.value(), vid.value(), from.value(), until.value(), comment.value()); + m_catalogue->createDedication(m_cliIdentity, drive.value(), type, tag, vid, from.value(), until.value(), comment.value()); } else if("ch" == m_requestTokens.at(2)) { //ch optional<std::string> vid = getOptionStringValue("-v", "--vid", false, false, false); @@ -1420,10 +1420,10 @@ void XrdCtaFile::xCom_dedication() { m_catalogue->modifyDedicationUntil(m_cliIdentity, drive.value(), until.value()); } if(vid) { - m_catalogue->modifyDedicationVid(m_cliIdentity, drive.value(), vid.value()); + m_catalogue->modifyDedicationVid(m_cliIdentity, drive.value(), vid); } if(tag) { - m_catalogue->modifyDedicationTag(m_cliIdentity, drive.value(), tag.value()); + m_catalogue->modifyDedicationTag(m_cliIdentity, drive.value(), tag); } if(readonly) { m_catalogue->modifyDedicationType(m_cliIdentity, drive.value(), cta::common::dataStructures::DedicationType::readonly); @@ -1498,7 +1498,6 @@ void XrdCtaFile::xCom_repack() { } if("add" == m_requestTokens.at(2)) { //add optional<std::string> tag = getOptionStringValue("-t", "--tag", false, false, false); - std::string tag_value = tag? tag.value():"-"; bool justexpand = hasOption("-e", "--justexpand"); bool justrepack = hasOption("-r", "--justrepack"); cta::common::dataStructures::RepackType type=cta::common::dataStructures::RepackType::expandandrepack; @@ -1512,7 +1511,7 @@ void XrdCtaFile::xCom_repack() { throw cta::exception::UserError(help.str()); } checkOptions(help.str()); - m_scheduler->repack(m_cliIdentity, vid.value(), tag_value, type); + m_scheduler->repack(m_cliIdentity, vid.value(), tag, type); } else if("err" == m_requestTokens.at(2)) { //err cta::common::dataStructures::RepackInfo info = m_scheduler->getRepack(m_cliIdentity, vid.value()); @@ -1616,11 +1615,9 @@ void XrdCtaFile::xCom_verify() { optional<std::string> vid = getOptionStringValue("-v", "--vid", false, true, false); if("add" == m_requestTokens.at(2)) { //add optional<std::string> tag = getOptionStringValue("-t", "--tag", false, false, false); - std::string tag_value = tag? tag.value():"-"; - optional<uint64_t> numberOfFiles = getOptionUint64Value("-p", "--partial", false, true, true, "0"); - //0 means do a complete verification + optional<uint64_t> numberOfFiles = getOptionUint64Value("-p", "--partial", false, false, false); //nullopt means do a complete verification checkOptions(help.str()); - m_scheduler->verify(m_cliIdentity, vid.value(), tag.value(), numberOfFiles.value()); + m_scheduler->verify(m_cliIdentity, vid.value(), tag, numberOfFiles); } else if("err" == m_requestTokens.at(2)) { //err checkOptions(help.str());