Commit d8776fc2 authored by Daniele Kruse's avatar Daniele Kruse
Browse files

Added last update time in the ArchiveFile and split the updatefileinfo command...

Added last update time in the ArchiveFile and split the updatefileinfo command in two: updatefileinfo (run by EOS during resynchronization process) and updatefilestorageclass (run by EOS on behalf of a user who wants to change the storage class of a file)
parent c6aa4dd2
......@@ -254,6 +254,7 @@ void cta::catalogue::SqliteCatalogue::createDbSchema() {
"CHECKSUM_VALUE VARCHAR2(100) NOT NULL,"
"STORAGE_CLASS_NAME VARCHAR2(100) NOT NULL,"
"CREATION_TIME INTEGER NOT NULL,"
"LASTUPDATE_TIME INTEGER NOT NULL,"
"RECOVERY_PATH VARCHAR2(2000) NOT NULL,"
"RECOVERY_OWNER VARCHAR2(100) NOT NULL,"
......@@ -1816,6 +1817,7 @@ uint64_t cta::catalogue::SqliteCatalogue::createArchiveFile(
"CHECKSUM_VALUE,"
"STORAGE_CLASS_NAME,"
"CREATION_TIME,"
"LASTUPDATE_TIME,"
"RECOVERY_PATH,"
"RECOVERY_OWNER,"
......@@ -1830,6 +1832,7 @@ uint64_t cta::catalogue::SqliteCatalogue::createArchiveFile(
":CHECKSUM_VALUE,"
":STORAGE_CLASS_NAME,"
":CREATION_TIME,"
":LASTUPDATE_TIME,"
":RECOVERY_PATH,"
":RECOVERY_OWNER,"
......@@ -1844,6 +1847,7 @@ uint64_t cta::catalogue::SqliteCatalogue::createArchiveFile(
stmt->bind(":CHECKSUM_VALUE", archiveFile.checksumValue);
stmt->bind(":STORAGE_CLASS_NAME", archiveFile.storageClass);
stmt->bind(":CREATION_TIME", now);
stmt->bind(":LASTUPDATE_TIME", now);
stmt->bind(":RECOVERY_PATH", archiveFile.drData.drPath);
stmt->bind(":RECOVERY_OWNER", archiveFile.drData.drOwner);
......@@ -1907,6 +1911,7 @@ std::list<cta::common::dataStructures::ArchiveFile>
"CHECKSUM_VALUE AS CHECKSUM_VALUE,"
"STORAGE_CLASS_NAME AS STORAGE_CLASS_NAME,"
"CREATION_TIME AS CREATION_TIME,"
"LASTUPDATE_TIME AS LASTUPDATE_TIME,"
"RECOVERY_PATH AS RECOVERY_PATH,"
"RECOVERY_OWNER AS RECOVERY_OWNER,"
......@@ -1934,6 +1939,9 @@ std::list<cta::common::dataStructures::ArchiveFile>
file.drData.drOwner = stmt->columnText(nameToIdx["RECOVERY_OWNER"]);
file.drData.drGroup = stmt->columnText(nameToIdx["RECOVERY_GROUP"]);
file.drData.drBlob = stmt->columnText(nameToIdx["RECOVERY_BLOB"]);
file.creationTime = stmt->columnUint64(nameToIdx["CREATION_TIME"]);
file.lastUpdateTime = stmt->columnUint64(nameToIdx["LASTUPDATE_TIME"]);
files.push_back(file);
}
......@@ -1962,6 +1970,7 @@ cta::common::dataStructures::ArchiveFile cta::catalogue::SqliteCatalogue::
"CHECKSUM_VALUE AS CHECKSUM_VALUE,"
"STORAGE_CLASS_NAME AS STORAGE_CLASS_NAME,"
"CREATION_TIME AS CREATION_TIME,"
"LASTUPDATE_TIME AS LASTUPDATE_TIME,"
"RECOVERY_PATH AS RECOVERY_PATH,"
"RECOVERY_OWNER AS RECOVERY_OWNER,"
......@@ -1994,6 +2003,9 @@ cta::common::dataStructures::ArchiveFile cta::catalogue::SqliteCatalogue::
file.drData.drOwner = stmt->columnText(nameToIdx["RECOVERY_OWNER"]);
file.drData.drGroup = stmt->columnText(nameToIdx["RECOVERY_GROUP"]);
file.drData.drBlob = stmt->columnText(nameToIdx["RECOVERY_BLOB"]);
file.creationTime = stmt->columnUint64(nameToIdx["CREATION_TIME"]);
file.lastUpdateTime = stmt->columnUint64(nameToIdx["LASTUPDATE_TIME"]);
return file;
}
......
......@@ -57,6 +57,7 @@ set (COMMON_LIB_SRC_FILES
dataStructures/TapePool.cpp
dataStructures/TestSourceType.cpp
dataStructures/UpdateFileInfoRequest.cpp
dataStructures/UpdateFileStorageClassRequest.cpp
dataStructures/UserIdentity.cpp
dataStructures/VerifyInfo.cpp
dataStructures/WriteTestResult.cpp
......
......@@ -26,7 +26,8 @@
cta::common::dataStructures::ArchiveFile::ArchiveFile():
archiveFileID(0),
fileSize(0),
creationTime(0) {}
creationTime(0),
lastUpdateTime(0) {}
//------------------------------------------------------------------------------
// operator==
......@@ -41,7 +42,8 @@ bool cta::common::dataStructures::ArchiveFile::operator==(const ArchiveFile &rhs
&& storageClass==rhs.storageClass
&& drData==rhs.drData
&& tapeCopies==rhs.tapeCopies
&& creationTime==rhs.creationTime;
&& creationTime==rhs.creationTime
&& lastUpdateTime==rhs.lastUpdateTime;
}
//------------------------------------------------------------------------------
......@@ -64,7 +66,8 @@ std::ostream &operator<<(std::ostream &os, const cta::common::dataStructures::Ar
<< " storageClass=" << obj.storageClass
<< " drData=" << obj.drData
<< " tapeCopies=" << obj.tapeCopies
<< " creationTime=" << obj.creationTime << ")";
<< " creationTime=" << obj.creationTime
<< " lastUpdateTime=" << obj.lastUpdateTime << ")";
return os;
}
......@@ -51,6 +51,7 @@ struct ArchiveFile {
cta::common::dataStructures::DRData drData;
std::map<uint64_t,cta::common::dataStructures::TapeFileLocation> tapeCopies;
time_t creationTime;
time_t lastUpdateTime;
}; // struct ArchiveFile
......
......@@ -30,9 +30,7 @@ cta::common::dataStructures::UpdateFileInfoRequest::UpdateFileInfoRequest():
// operator==
//------------------------------------------------------------------------------
bool cta::common::dataStructures::UpdateFileInfoRequest::operator==(const UpdateFileInfoRequest &rhs) const {
return requester==rhs.requester
&& archiveFileID==rhs.archiveFileID
&& storageClass==rhs.storageClass
return archiveFileID==rhs.archiveFileID
&& drData==rhs.drData;
}
......@@ -47,9 +45,7 @@ bool cta::common::dataStructures::UpdateFileInfoRequest::operator!=(const Update
// operator<<
//------------------------------------------------------------------------------
std::ostream &operator<<(std::ostream &os, const cta::common::dataStructures::UpdateFileInfoRequest &obj) {
os << "(requester=" << obj.requester
<< " archiveFileID=" << obj.archiveFileID
<< " storageClass=" << obj.storageClass
os << "(archiveFileID=" << obj.archiveFileID
<< " drData=" << obj.drData << ")";
return os;
}
......
......@@ -24,14 +24,13 @@
#include <string>
#include "common/dataStructures/DRData.hpp"
#include "common/dataStructures/UserIdentity.hpp"
namespace cta {
namespace common {
namespace dataStructures {
/*
* This request is issued by the disk based system to update some of the metadata of a specific file
* This struct holds all the command line parameters of a CTA UpdateFileInfo command
*/
struct UpdateFileInfoRequest {
......@@ -41,9 +40,7 @@ struct UpdateFileInfoRequest {
bool operator!=(const UpdateFileInfoRequest &rhs) const;
cta::common::dataStructures::UserIdentity requester;
uint64_t archiveFileID;
std::string storageClass;
cta::common::dataStructures::DRData drData;
}; // struct UpdateFileInfoRequest
......
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common/dataStructures/UpdateFileStorageClassRequest.hpp"
#include "common/dataStructures/utils.hpp"
#include "common/exception/Exception.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::common::dataStructures::UpdateFileStorageClassRequest::UpdateFileStorageClassRequest():
archiveFileID(0) {}
//------------------------------------------------------------------------------
// operator==
//------------------------------------------------------------------------------
bool cta::common::dataStructures::UpdateFileStorageClassRequest::operator==(const UpdateFileStorageClassRequest &rhs) const {
return requester==rhs.requester
&& archiveFileID==rhs.archiveFileID
&& storageClass==rhs.storageClass
&& drData==rhs.drData;
}
//------------------------------------------------------------------------------
// operator!=
//------------------------------------------------------------------------------
bool cta::common::dataStructures::UpdateFileStorageClassRequest::operator!=(const UpdateFileStorageClassRequest &rhs) const {
return !operator==(rhs);
}
//------------------------------------------------------------------------------
// operator<<
//------------------------------------------------------------------------------
std::ostream &operator<<(std::ostream &os, const cta::common::dataStructures::UpdateFileStorageClassRequest &obj) {
os << "(requester=" << obj.requester
<< " archiveFileID=" << obj.archiveFileID
<< " storageClass=" << obj.storageClass
<< " drData=" << obj.drData << ")";
return os;
}
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <list>
#include <map>
#include <stdint.h>
#include <string>
#include "common/dataStructures/DRData.hpp"
#include "common/dataStructures/UserIdentity.hpp"
namespace cta {
namespace common {
namespace dataStructures {
/*
* This struct holds all the command line parameters of a CTA UpdateFileStorageClass command
*/
struct UpdateFileStorageClassRequest {
UpdateFileStorageClassRequest();
bool operator==(const UpdateFileStorageClassRequest &rhs) const;
bool operator!=(const UpdateFileStorageClassRequest &rhs) const;
cta::common::dataStructures::UserIdentity requester;
uint64_t archiveFileID;
std::string storageClass;
cta::common::dataStructures::DRData drData;
}; // struct UpdateFileStorageClassRequest
} // namespace dataStructures
} // namespace common
} // namespace cta
std::ostream &operator<<(std::ostream &os, const cta::common::dataStructures::UpdateFileStorageClassRequest &obj);
EOS communicates with CTA by issuing commands on trusted hosts. EOS can archive a file, retrieve it, update its
information, delete it or simply list the available storage classes. See the LimitingInstanceCrosstalk.txt file for more
details on how these commands are authorized by CTA.
information/storage class, delete it or simply list the available storage classes. See the LimitingInstanceCrosstalk.txt
file for more details on how these commands are authorized by CTA.
**********ARCHIVING from EOS to CTA**********
......@@ -56,7 +56,7 @@ Note: DR info is piggybacked
**********DELETING an ARCHIVE FILE**********
1) EOS REQUEST: cta da/deletearchive --encoded <\"true\" or \"false\"> // true if all following arguments are base64 encoded, false if all following arguments are in clear (no mixing of encoded and clear arguments)
1) EOS REQUEST: cta da/deletearchive --encoded <"true" or "false"> // true if all following arguments are base64 encoded, false if all following arguments are in clear (no mixing of encoded and clear arguments)
--user <user> // string name of the requester of the action (deletion), used for logging, not kept by CTA after successful operation
--group <group> // string group of the requester of the action (deletion), used for logging, not kept by CTA after successful operation
--id <CTA_ArchiveFileID> // uint64_t which is the unique ID of the CTA file
......@@ -67,7 +67,7 @@ Note: This command may be issued even before the actual archival process has beg
**********CANCELING a SCHEDULED RETRIEVAL**********
1) EOS REQUEST: cta cr/cancelretrieve --encoded <\"true\" or \"false\"> // true if all following arguments are base64 encoded, false if all following arguments are in clear (no mixing of encoded and clear arguments)
1) EOS REQUEST: cta cr/cancelretrieve --encoded <"true" or "false"> // true if all following arguments are base64 encoded, false if all following arguments are in clear (no mixing of encoded and clear arguments)
--user <user> // string name of the requester of the action (cancel), used for logging, not kept by CTA after successful operation
--group <group> // string group of the requester of the action (cancel), used for logging, not kept by CTA after successful operation
--id <CTA_ArchiveFileID> // uint64_t which is the unique ID of the CTA file
......@@ -82,25 +82,39 @@ Note: DR info is piggybacked
2) CTA IMMEDIATE REPLY: Empty or Error
**********UPDATE the STORAGE CLASS of a FILE**********
1) EOS REQUEST: cta ufsc/updatefilestorageclass --encoded <"true" or "false"> // true if all following arguments are base64 encoded, false if all following arguments are in clear (no mixing of encoded and clear arguments)
--user <user> // string name of the requester of the action (update), used for logging, not kept by CTA after successful operation
--group <group> // string group of the requester of the action (update), used for logging, not kept by CTA after successful operation
--id <CTA_ArchiveFileID> // uint64_t which is the unique ID of the CTA file
--storageclass <storage_class> // updated storage class which may or may not have a different routing
--dr_path <DR_path> // string kept by CTA for disaster recovery and for logging
--dr_owner <DR_owner> // string kept by CTA for disaster recovery and for logging
--dr_ownergroup <DR_group> // string kept by CTA for disaster recovery and for logging
--dr_blob <DR_blob> // 2KB string kept by CTA for disaster recovery (opaque string controlled by EOS)
Note: This command DOES NOT change the number of tape copies! The number will change asynchronously (next repack or "reconciliation").
Note: DR info is piggybacked
2) CTA IMMEDIATE REPLY: Empty or Error
**********UPDATE INFO of a FILE**********
1) EOS REQUEST: cta ufi/updatefileinfo --encoded <\"true\" or \"false\"> // true if all following arguments are base64 encoded, false if all following arguments are in clear (no mixing of encoded and clear arguments)
--user <user> // string name of the requester of the action (update), used for logging, not kept by CTA after successful operation
--group <group> // string group of the requester of the action (update), used for logging, not kept by CTA after successful operation
1) EOS REQUEST: cta ufi/updatefileinfo --encoded <"true" or "false"> // true if all following arguments are base64 encoded, false if all following arguments are in clear (no mixing of encoded and clear arguments)
--id <CTA_ArchiveFileID> // uint64_t which is the unique ID of the CTA file
--storageclass <storage_class> // updated storage class which may or may not have a different routing
--dr_path <DR_path> // string kept by CTA for disaster recovery and for logging
--dr_owner <DR_owner> // string kept by CTA for disaster recovery and for logging
--dr_ownergroup <DR_group> // string kept by CTA for disaster recovery and for logging
--dr_blob <DR_blob> // 2KB string kept by CTA for disaster recovery (opaque string controlled by EOS)
Note: This command DOES NOT change the number of tape copies! The number will change asynchronously (next repack or "reconciliation").
Note: This command is not executed on behalf of an EOS user. Instead it is part of a resynchronization process initiated by EOS.
2) CTA IMMEDIATE REPLY: Empty or Error
**********LISTING all STORAGE CLASSES available**********
1) EOS REQUEST: cta lsc/liststorageclass --encoded <\"true\" or \"false\"> // true if all following arguments are base64 encoded, false if all following arguments are in clear (no mixing of encoded and clear arguments)
1) EOS REQUEST: cta lsc/liststorageclass --encoded <"true" or "false"> // true if all following arguments are base64 encoded, false if all following arguments are in clear (no mixing of encoded and clear arguments)
--user <user> // string name of the requester of the action (listing), used for logging, not kept by CTA after successful operation
--group <group> // string group of the requester of the action (listing), used for logging, not kept by CTA after successful operation
......
......@@ -50,7 +50,7 @@ void cta::Scheduler::authorizeCliIdentity(const cta::common::dataStructures::Sec
}
//------------------------------------------------------------------------------
// queueArchiveRequest
// queueArchive
//------------------------------------------------------------------------------
uint64_t cta::Scheduler::queueArchive(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::ArchiveRequest &request) {
const cta::common::dataStructures::ArchiveFileQueueCriteria criteria = m_catalogue.prepareForNewFile(request.storageClass, request.requester);
......@@ -61,35 +61,42 @@ uint64_t cta::Scheduler::queueArchive(const cta::common::dataStructures::Securit
}
//------------------------------------------------------------------------------
// queueRetrieveRequest
// queueRetrieve
//------------------------------------------------------------------------------
void cta::Scheduler::queueRetrieve(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::RetrieveRequest &request) {
}
//------------------------------------------------------------------------------
// deleteArchiveRequest
// deleteArchive
//------------------------------------------------------------------------------
void cta::Scheduler::deleteArchive(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::DeleteArchiveRequest &request) {
}
//------------------------------------------------------------------------------
// cancelRetrieveRequest
// cancelRetrieve
//------------------------------------------------------------------------------
void cta::Scheduler::cancelRetrieve(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::CancelRetrieveRequest &request) {
}
//------------------------------------------------------------------------------
// updateFileInfoRequest
// updateFileInfo
//------------------------------------------------------------------------------
void cta::Scheduler::updateFileInfo(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::UpdateFileInfoRequest &request) {
}
//------------------------------------------------------------------------------
// listStorageClassRequest
// updateFileStorageClass
//------------------------------------------------------------------------------
void cta::Scheduler::updateFileStorageClass(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::UpdateFileStorageClassRequest &request) {
}
//------------------------------------------------------------------------------
// listStorageClass
//------------------------------------------------------------------------------
std::list<cta::common::dataStructures::StorageClass> cta::Scheduler::listStorageClass(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::ListStorageClassRequest &request) {
return std::list<cta::common::dataStructures::StorageClass>();
......
......@@ -36,6 +36,7 @@
#include "common/dataStructures/StorageClass.hpp"
#include "common/dataStructures/TestSourceType.hpp"
#include "common/dataStructures/UpdateFileInfoRequest.hpp"
#include "common/dataStructures/UpdateFileStorageClassRequest.hpp"
#include "common/dataStructures/VerifyInfo.hpp"
#include "common/dataStructures/WriteTestResult.hpp"
......@@ -75,6 +76,7 @@ public:
virtual void deleteArchive(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::DeleteArchiveRequest &request);
virtual void cancelRetrieve(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::CancelRetrieveRequest &request);
virtual void updateFileInfo(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::UpdateFileInfoRequest &request);
virtual void updateFileStorageClass(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::UpdateFileStorageClassRequest &request);
virtual std::list<cta::common::dataStructures::StorageClass> listStorageClass(const cta::common::dataStructures::SecurityIdentity &cliIdentity, 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);
......
......@@ -87,33 +87,34 @@ void XrdCtaFile::dispatchCommand(const std::vector<std::string> &tokens, const c
m_scheduler->authorizeCliIdentity(cliIdentity);
}
if ("bs" == command || "bootstrap" == command) {xCom_bootstrap(tokens, cliIdentity);}
else if("ad" == command || "admin" == command) {xCom_admin(tokens, cliIdentity);}
else if("ah" == command || "adminhost" == command) {xCom_adminhost(tokens, cliIdentity);}
else if("tp" == command || "tapepool" == command) {xCom_tapepool(tokens, cliIdentity);}
else if("ar" == command || "archiveroute" == command) {xCom_archiveroute(tokens, cliIdentity);}
else if("ll" == command || "logicallibrary" == command) {xCom_logicallibrary(tokens, cliIdentity);}
else if("ta" == command || "tape" == command) {xCom_tape(tokens, cliIdentity);}
else if("sc" == command || "storageclass" == command) {xCom_storageclass(tokens, cliIdentity);}
else if("us" == command || "user" == command) {xCom_user(tokens, cliIdentity);}
else if("mg" == command || "mountgroup" == command) {xCom_mountgroup(tokens, cliIdentity);}
else if("de" == command || "dedication" == command) {xCom_dedication(tokens, cliIdentity);}
else if("re" == command || "repack" == command) {xCom_repack(tokens, cliIdentity);}
else if("sh" == command || "shrink" == command) {xCom_shrink(tokens, cliIdentity);}
else if("ve" == command || "verify" == command) {xCom_verify(tokens, cliIdentity);}
else if("af" == command || "archivefile" == command) {xCom_archivefile(tokens, cliIdentity);}
else if("te" == command || "test" == command) {xCom_test(tokens, cliIdentity);}
else if("dr" == command || "drive" == command) {xCom_drive(tokens, cliIdentity);}
else if("rc" == command || "reconcile" == command) {xCom_reconcile(tokens, cliIdentity);}
else if("lpa" == command || "listpendingarchives" == command) {xCom_listpendingarchives(tokens, cliIdentity);}
else if("lpr" == command || "listpendingretrieves" == command) {xCom_listpendingretrieves(tokens, cliIdentity);}
else if("lds" == command || "listdrivestates" == command) {xCom_listdrivestates(tokens, cliIdentity);}
else if("a" == command || "archive" == command) {xCom_archive(tokens, cliIdentity);}
else if("r" == command || "retrieve" == command) {xCom_retrieve(tokens, cliIdentity);}
else if("da" == command || "deletearchive" == command) {xCom_deletearchive(tokens, cliIdentity);}
else if("cr" == command || "cancelretrieve" == command) {xCom_cancelretrieve(tokens, cliIdentity);}
else if("ufi" == command || "updatefileinfo" == command) {xCom_updatefileinfo(tokens, cliIdentity);}
else if("lsc" == command || "liststorageclass" == command) {xCom_liststorageclass(tokens, cliIdentity);}
if ("bs" == command || "bootstrap" == command) {xCom_bootstrap(tokens, cliIdentity);}
else if("ad" == command || "admin" == command) {xCom_admin(tokens, cliIdentity);}
else if("ah" == command || "adminhost" == command) {xCom_adminhost(tokens, cliIdentity);}
else if("tp" == command || "tapepool" == command) {xCom_tapepool(tokens, cliIdentity);}
else if("ar" == command || "archiveroute" == command) {xCom_archiveroute(tokens, cliIdentity);}
else if("ll" == command || "logicallibrary" == command) {xCom_logicallibrary(tokens, cliIdentity);}
else if("ta" == command || "tape" == command) {xCom_tape(tokens, cliIdentity);}
else if("sc" == command || "storageclass" == command) {xCom_storageclass(tokens, cliIdentity);}
else if("us" == command || "user" == command) {xCom_user(tokens, cliIdentity);}
else if("mg" == command || "mountgroup" == command) {xCom_mountgroup(tokens, cliIdentity);}
else if("de" == command || "dedication" == command) {xCom_dedication(tokens, cliIdentity);}
else if("re" == command || "repack" == command) {xCom_repack(tokens, cliIdentity);}
else if("sh" == command || "shrink" == command) {xCom_shrink(tokens, cliIdentity);}
else if("ve" == command || "verify" == command) {xCom_verify(tokens, cliIdentity);}
else if("af" == command || "archivefile" == command) {xCom_archivefile(tokens, cliIdentity);}
else if("te" == command || "test" == command) {xCom_test(tokens, cliIdentity);}
else if("dr" == command || "drive" == command) {xCom_drive(tokens, cliIdentity);}
else if("rc" == command || "reconcile" == command) {xCom_reconcile(tokens, cliIdentity);}
else if("lpa" == command || "listpendingarchives" == command) {xCom_listpendingarchives(tokens, cliIdentity);}
else if("lpr" == command || "listpendingretrieves" == command) {xCom_listpendingretrieves(tokens, cliIdentity);}
else if("lds" == command || "listdrivestates" == command) {xCom_listdrivestates(tokens, cliIdentity);}
else if("a" == command || "archive" == command) {xCom_archive(tokens, cliIdentity);}
else if("r" == command || "retrieve" == command) {xCom_retrieve(tokens, cliIdentity);}
else if("da" == command || "deletearchive" == command) {xCom_deletearchive(tokens, cliIdentity);}
else if("cr" == command || "cancelretrieve" == command) {xCom_cancelretrieve(tokens, cliIdentity);}
else if("ufi" == command || "updatefileinfo" == command) {xCom_updatefileinfo(tokens, cliIdentity);}
else if("ufsc" == command || "updatefilestorageclass" == command) {xCom_updatefilestorageclass(tokens, cliIdentity);}
else if("lsc" == command || "liststorageclass" == command) {xCom_liststorageclass(tokens, cliIdentity);}
else {m_data = getGenericHelp(tokens[0]);}
}
......@@ -2107,11 +2108,11 @@ void XrdCtaFile::xCom_cancelretrieve(const std::vector<std::string> &tokens, con
}
//------------------------------------------------------------------------------
// xCom_updatefileinfo
// xCom_updatefilestorageclass
//------------------------------------------------------------------------------
void XrdCtaFile::xCom_updatefileinfo(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &cliIdentity) {
void XrdCtaFile::xCom_updatefilestorageclass(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &cliIdentity) {
std::stringstream help;
help << tokens[0] << " ufi/updatefileinfo --encoded <\"true\" or \"false\"> --user <user> --group <group> --id <CTA_ArchiveFileID> --storageclass <storage_class> --dr_path <DR_path>" << std::endl
help << tokens[0] << " ufsc/updatefilestorageclass --encoded <\"true\" or \"false\"> --user <user> --group <group> --id <CTA_ArchiveFileID> --storageclass <storage_class> --dr_path <DR_path>" << std::endl
<< "\t--dr_owner <DR_owner> --dr_ownergroup <DR_group> --dr_blob <DR_blob>" << std::endl;
std::string encoded_s = getOptionValue(tokens, "", "--encoded", false);
if(encoded_s!="true" && encoded_s!="false") {
......@@ -2140,11 +2141,45 @@ void XrdCtaFile::xCom_updatefileinfo(const std::vector<std::string> &tokens, con
drData.drGroup=dr_ownergroup;
drData.drOwner=dr_owner;
drData.drPath=dr_path;
cta::common::dataStructures::UpdateFileInfoRequest request;
cta::common::dataStructures::UpdateFileStorageClassRequest request;
request.drData=drData;
request.archiveFileID=id;
request.requester=originator;
request.storageClass=storageclass;
m_scheduler->updateFileStorageClass(cliIdentity, request);
}
//------------------------------------------------------------------------------
// xCom_updatefileinfo
//------------------------------------------------------------------------------
void XrdCtaFile::xCom_updatefileinfo(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &cliIdentity) {
std::stringstream help;
help << tokens[0] << " ufi/updatefileinfo --encoded <\"true\" or \"false\"> --id <CTA_ArchiveFileID> --dr_path <DR_path>" << std::endl
<< "\t--dr_owner <DR_owner> --dr_ownergroup <DR_group> --dr_blob <DR_blob>" << std::endl;
std::string encoded_s = getOptionValue(tokens, "", "--encoded", false);
if(encoded_s!="true" && encoded_s!="false") {
m_data = help.str();
return;
}
bool encoded = encoded_s=="true"?true:false;
std::string id_s = getOptionValue(tokens, "", "--id", encoded);
std::string dr_path = getOptionValue(tokens, "", "--dr_path", encoded);
std::string dr_owner = getOptionValue(tokens, "", "--dr_owner", encoded);
std::string dr_ownergroup = getOptionValue(tokens, "", "--dr_ownergroup", encoded);
std::string dr_blob = getOptionValue(tokens, "", "--dr_blob", encoded);
if(id_s.empty() || dr_path.empty() || dr_owner.empty() || dr_ownergroup.empty() || dr_blob.empty()) {
m_data = help.str();
return;
}
uint64_t id = stringParameterToUint64("--id", id_s);
cta::common::dataStructures::DRData drData;
drData.drBlob=dr_blob;
drData.drGroup=dr_ownergroup;
drData.drOwner=dr_owner;
drData.drPath=dr_path;
cta::common::dataStructures::UpdateFileInfoRequest request;
request.drData=drData;
request.archiveFileID=id;
m_scheduler->updateFileInfo(cliIdentity, request);
}
......@@ -2215,6 +2250,7 @@ std::string XrdCtaFile::getGenericHelp(const std::string &programName) const {
help << programName << " liststorageclass/lsc" << std::endl;
help << programName << " retrieve/r" << std::endl;
help << programName << " updatefileinfo/ufi" << std::endl;
help << programName << " updatefilestorageclass/ufsc" << std::endl;
return help.str();
}
......
......@@ -154,6 +154,7 @@ protected:
void xCom_deletearchive(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &cliIdentity);
void xCom_cancelretrieve(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &cliIdentity);
void xCom_updatefileinfo(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &cliIdentity);
void xCom_updatefilestorageclass(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &cliIdentity);
void xCom_liststorageclass(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &cliIdentity);
/**
......
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