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

Changed the documentation fro the eos interface and the instance crosstalk,...

Changed the documentation fro the eos interface and the instance crosstalk, renamed User into Requester, refactored all the SQLITE code to have a GROUPNAME column in the requester, changed the tests
parent 4b749517
......@@ -46,6 +46,7 @@
#include "common/dataStructures/ReadTestResult.hpp"
#include "common/dataStructures/RepackInfo.hpp"
#include "common/dataStructures/RepackType.hpp"
#include "common/dataStructures/Requester.hpp"
#include "common/dataStructures/RetrieveJob.hpp"
#include "common/dataStructures/RetrieveRequest.hpp"
#include "common/dataStructures/SecurityIdentity.hpp"
......@@ -56,7 +57,6 @@
#include "common/dataStructures/TapePool.hpp"
#include "common/dataStructures/UpdateFileInfoRequest.hpp"
#include "common/dataStructures/MountGroup.hpp"
#include "common/dataStructures/User.hpp"
#include "common/dataStructures/UserIdentity.hpp"
#include "common/dataStructures/VerifyInfo.hpp"
#include "common/dataStructures/WriteTestResult.hpp"
......@@ -134,16 +134,16 @@ public:
virtual void setTapeLbp(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool lbpValue) = 0; // internal function (noCLI)
virtual void modifyTapeComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &comment) = 0;
virtual void createUser(
virtual void createRequester(
const cta::common::dataStructures::SecurityIdentity &cliIdentity,
const std::string &name,
const cta::common::dataStructures::UserIdentity &user,
const std::string &mountGroup,
const std::string &comment) = 0;
virtual void deleteUser(const std::string &name, const std::string &group) = 0;
virtual std::list<cta::common::dataStructures::User> getUsers() const = 0;
virtual void modifyUserMountGroup(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &group, const std::string &mountGroup) = 0;
virtual void modifyUserComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &group, const std::string &comment) = 0;
virtual void deleteRequester(const cta::common::dataStructures::UserIdentity &user) = 0;
virtual std::list<cta::common::dataStructures::Requester> getRequesters() const = 0;
virtual void modifyRequesterMountGroup(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::UserIdentity &user, const std::string &mountGroup) = 0;
virtual void modifyRequesterComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::UserIdentity &user, const std::string &comment) = 0;
virtual void createMountGroup(
const cta::common::dataStructures::SecurityIdentity &cliIdentity,
......@@ -201,7 +201,7 @@ public:
* @return The information required to queue the associated archive request.
*/
virtual cta::common::dataStructures::ArchiveFileQueueCriteria
prepareForNewFile(const std::string &storageClass, const std::string &user)
prepareForNewFile(const std::string &storageClass, const cta::common::dataStructures::UserIdentity &user)
= 0;
/**
......@@ -223,7 +223,7 @@ public:
* @return The archive mount policy.
*/
virtual cta::common::dataStructures::MountPolicy getArchiveMountPolicy(
const std::string &user) const = 0;
const cta::common::dataStructures::UserIdentity &user) const = 0;
/**
* Returns the retrieve mount policy for the specified end user.
......@@ -232,7 +232,7 @@ public:
* @return The retrieve mount policy.
*/
virtual cta::common::dataStructures::MountPolicy getRetrieveMountPolicy(
const std::string &user) const = 0;
const cta::common::dataStructures::UserIdentity &user) const = 0;
virtual bool isAdmin(const cta::common::dataStructures::SecurityIdentity &cliIdentity) const = 0;
......
......@@ -223,8 +223,9 @@ void cta::catalogue::SqliteCatalogue::createDbSchema() {
"PRIMARY KEY(MOUNT_GROUP_NAME)"
");"
"CREATE TABLE END_USER("
"CREATE TABLE REQUESTER("
"USER_NAME VARCHAR2(100) NOT NULL,"
"GROUP_NAME VARCHAR2(100) NOT NULL,"
"MOUNT_GROUP_NAME VARCHAR2(100) NOT NULL,"
......@@ -240,7 +241,7 @@ void cta::catalogue::SqliteCatalogue::createDbSchema() {
"LAST_MOD_HOST_NAME VARCHAR2(100) NOT NULL,"
"LAST_MOD_TIME INTEGER NOT NULL,"
"PRIMARY KEY(USER_NAME),"
"PRIMARY KEY(USER_NAME, GROUP_NAME),"
"FOREIGN KEY(MOUNT_GROUP_NAME) REFERENCES "
"MOUNT_GROUP(MOUNT_GROUP_NAME)"
");"
......@@ -1394,17 +1395,18 @@ void cta::catalogue::SqliteCatalogue::setTapeLbp(const cta::common::dataStructur
void cta::catalogue::SqliteCatalogue::modifyTapeComment(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &comment) {}
//------------------------------------------------------------------------------
// createUser
// createRequester
//------------------------------------------------------------------------------
void cta::catalogue::SqliteCatalogue::createUser(
void cta::catalogue::SqliteCatalogue::createRequester(
const common::dataStructures::SecurityIdentity &cliIdentity,
const std::string &name,
const cta::common::dataStructures::UserIdentity &user,
const std::string &mountGroup,
const std::string &comment) {
const uint64_t now = time(NULL);
const char *const sql =
"INSERT INTO END_USER("
"INSERT INTO REQUESTER("
"USER_NAME,"
"GROUP_NAME,"
"MOUNT_GROUP_NAME,"
"USER_COMMENT,"
......@@ -1420,6 +1422,7 @@ void cta::catalogue::SqliteCatalogue::createUser(
"LAST_MOD_TIME)"
"VALUES("
":USER_NAME,"
":GROUP_NAME,"
":MOUNT_GROUP_NAME,"
":USER_COMMENT,"
......@@ -1435,7 +1438,8 @@ void cta::catalogue::SqliteCatalogue::createUser(
":CREATION_LOG_TIME);";
std::unique_ptr<SqliteStmt> stmt(m_conn.createStmt(sql));
stmt->bind(":USER_NAME", name);
stmt->bind(":USER_NAME", user.name);
stmt->bind(":GROUP_NAME", user.group);
stmt->bind(":MOUNT_GROUP_NAME", mountGroup);
stmt->bind(":USER_COMMENT", comment);
......@@ -1449,19 +1453,20 @@ void cta::catalogue::SqliteCatalogue::createUser(
}
//------------------------------------------------------------------------------
// deleteUser
// deleteRequester
//------------------------------------------------------------------------------
void cta::catalogue::SqliteCatalogue::deleteUser(const std::string &name, const std::string &group) {}
void cta::catalogue::SqliteCatalogue::deleteRequester(const cta::common::dataStructures::UserIdentity &user) {}
//------------------------------------------------------------------------------
// getUsers
// getRequesters
//------------------------------------------------------------------------------
std::list<cta::common::dataStructures::User>
cta::catalogue::SqliteCatalogue::getUsers() const {
std::list<common::dataStructures::User> users;
std::list<cta::common::dataStructures::Requester>
cta::catalogue::SqliteCatalogue::getRequesters() const {
std::list<common::dataStructures::Requester> users;
const char *const sql =
"SELECT "
"USER_NAME AS USER_NAME,"
"GROUP_NAME AS GROUP_NAME,"
"MOUNT_GROUP_NAME AS MOUNT_GROUP_NAME,"
"USER_COMMENT AS USER_COMMENT,"
......@@ -1475,17 +1480,17 @@ std::list<cta::common::dataStructures::User>
"LAST_MOD_GROUP_NAME AS LAST_MOD_GROUP_NAME,"
"LAST_MOD_HOST_NAME AS LAST_MOD_HOST_NAME,"
"LAST_MOD_TIME AS LAST_MOD_TIME "
"FROM END_USER;";
"FROM REQUESTER;";
std::unique_ptr<SqliteStmt> stmt(m_conn.createStmt(sql));
ColumnNameToIdx nameToIdx;
while(SQLITE_ROW == stmt->step()) {
if(nameToIdx.empty()) {
nameToIdx = stmt->getColumnNameToIdx();
}
common::dataStructures::User user;
common::dataStructures::UserIdentity adminUI;
common::dataStructures::Requester user;
user.name = stmt->columnText(nameToIdx["USER_NAME"]);
user.group = stmt->columnText(nameToIdx["GROUP_NAME"]);
user.mountGroupName = stmt->columnText(nameToIdx["MOUNT_GROUP_NAME"]);
user.comment = stmt->columnText(nameToIdx["USER_COMMENT"]);
......@@ -1519,14 +1524,14 @@ std::list<cta::common::dataStructures::User>
}
//------------------------------------------------------------------------------
// modifyUserMountGroup
// modifyRequesterMountGroup
//------------------------------------------------------------------------------
void cta::catalogue::SqliteCatalogue::modifyUserMountGroup(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &group, const std::string &mountGroup) {}
void cta::catalogue::SqliteCatalogue::modifyRequesterMountGroup(const common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::UserIdentity &user, const std::string &mountGroup) {}
//------------------------------------------------------------------------------
// modifyUserComment
// modifyRequesterComment
//------------------------------------------------------------------------------
void cta::catalogue::SqliteCatalogue::modifyUserComment(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &group, const std::string &comment) {}
void cta::catalogue::SqliteCatalogue::modifyRequesterComment(const common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::UserIdentity &user, const std::string &comment) {}
//------------------------------------------------------------------------------
// createMountGroup
......@@ -2012,7 +2017,7 @@ void cta::catalogue::SqliteCatalogue::fileWrittenToTape(
//------------------------------------------------------------------------------
cta::common::dataStructures::ArchiveFileQueueCriteria
cta::catalogue::SqliteCatalogue::prepareForNewFile(
const std::string &storageClass, const std::string &user) {
const std::string &storageClass, const cta::common::dataStructures::UserIdentity &user) {
const common::dataStructures::TapeCopyToPoolMap copyToPoolMap =
getTapeCopyToPoolMap(storageClass);
const uint64_t expectedNbRoutes = getExpectedNbArchiveRoutes(storageClass);
......@@ -2096,19 +2101,21 @@ uint64_t cta::catalogue::SqliteCatalogue::getExpectedNbArchiveRoutes(
// getArchiveMountPolicy
//------------------------------------------------------------------------------
cta::common::dataStructures::MountPolicy cta::catalogue::SqliteCatalogue::
getArchiveMountPolicy(const std::string &user) const {
getArchiveMountPolicy(const cta::common::dataStructures::UserIdentity &user) const {
const char *const sql =
"SELECT "
"ARCHIVE_PRIORITY AS ARCHIVE_PRIORITY,"
"ARCHIVE_MIN_REQUEST_AGE AS ARCHIVE_MIN_REQUEST_AGE,"
"MAX_DRIVES_ALLOWED AS MAX_DRIVES_ALLOWED "
"FROM MOUNT_GROUP INNER JOIN END_USER ON "
"MOUNT_GROUP.MOUNT_GROUP_NAME = END_USER.MOUNT_GROUP_NAME "
"FROM MOUNT_GROUP INNER JOIN REQUESTER ON "
"MOUNT_GROUP.MOUNT_GROUP_NAME = REQUESTER.MOUNT_GROUP_NAME "
"WHERE "
"USER_NAME = :USER_NAME;";
"USER_NAME = :USER_NAME AND "
"GROUP_NAME = :GROUP_NAME;";
std::unique_ptr<SqliteStmt> stmt(m_conn.createStmt(sql));
stmt->bind(":USER_NAME", user);
stmt->bind(":USER_NAME", user.name);
stmt->bind(":GROUP_NAME", user.group);
ColumnNameToIdx nameToIdx;
if(SQLITE_ROW == stmt->step()) {
nameToIdx = stmt->getColumnNameToIdx();
......@@ -2129,19 +2136,21 @@ cta::common::dataStructures::MountPolicy cta::catalogue::SqliteCatalogue::
// getRetrieveMountPolicy
//------------------------------------------------------------------------------
cta::common::dataStructures::MountPolicy cta::catalogue::SqliteCatalogue::
getRetrieveMountPolicy(const std::string &user) const {
getRetrieveMountPolicy(const cta::common::dataStructures::UserIdentity &user) const {
const char *const sql =
"SELECT "
"RETRIEVE_PRIORITY AS RETRIEVE_PRIORITY,"
"RETRIEVE_MIN_REQUEST_AGE AS RETRIEVE_MIN_REQUEST_AGE,"
"MAX_DRIVES_ALLOWED AS MAX_DRIVES_ALLOWED "
"FROM MOUNT_GROUP INNER JOIN END_USER ON "
"MOUNT_GROUP.MOUNT_GROUP_NAME = END_USER.MOUNT_GROUP_NAME "
"FROM MOUNT_GROUP INNER JOIN REQUESTER ON "
"MOUNT_GROUP.MOUNT_GROUP_NAME = REQUESTER.MOUNT_GROUP_NAME "
"WHERE "
"USER_NAME = :USER_NAME;";
"USER_NAME = :USER_NAME AND "
"GROUP_NAME = :GROUP_NAME;";
std::unique_ptr<SqliteStmt> stmt(m_conn.createStmt(sql));
stmt->bind(":USER_NAME", user);
stmt->bind(":USER_NAME", user.name);
stmt->bind(":GROUP_NAME", user.group);
ColumnNameToIdx nameToIdx;
if(SQLITE_ROW == stmt->step()) {
nameToIdx = stmt->getColumnNameToIdx();
......
......@@ -98,11 +98,11 @@ public:
virtual void setTapeLbp(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool lbpValue); // internal function (noCLI)
virtual void modifyTapeComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &comment);
virtual void createUser(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &mountGroup, const std::string &comment);
virtual void deleteUser(const std::string &name, const std::string &group);
virtual std::list<cta::common::dataStructures::User> getUsers() const;
virtual void modifyUserMountGroup(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &group, const std::string &mountGroup);
virtual void modifyUserComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &group, const std::string &comment);
virtual void createRequester(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::UserIdentity &user, const std::string &mountGroup, const std::string &comment);
virtual void deleteRequester(const cta::common::dataStructures::UserIdentity &user);
virtual std::list<cta::common::dataStructures::Requester> getRequesters() const;
virtual void modifyRequesterMountGroup(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::UserIdentity &user, const std::string &mountGroup);
virtual void modifyRequesterComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::UserIdentity &user, const std::string &comment);
virtual void createMountGroup(
const cta::common::dataStructures::SecurityIdentity &cliIdentity,
......@@ -183,7 +183,7 @@ public:
* @return The information required to queue the associated archive request.
*/
virtual cta::common::dataStructures::ArchiveFileQueueCriteria
prepareForNewFile(const std::string &storageClass, const std::string &user);
prepareForNewFile(const std::string &storageClass, const cta::common::dataStructures::UserIdentity &user);
virtual cta::common::dataStructures::TapeCopyToPoolMap getTapeCopyToPoolMap(const std::string &storageClass) const;
......@@ -194,7 +194,7 @@ public:
* @return The archive mount policy.
*/
virtual cta::common::dataStructures::MountPolicy getArchiveMountPolicy(
const std::string &user) const;
const cta::common::dataStructures::UserIdentity &user) const;
/**
* Returns the retrieve mount policy for the specified end user.
......@@ -203,7 +203,7 @@ public:
* @return The retrieve mount policy.
*/
virtual cta::common::dataStructures::MountPolicy getRetrieveMountPolicy(
const std::string &user) const;
const cta::common::dataStructures::UserIdentity &user) const;
virtual bool isAdmin(const cta::common::dataStructures::SecurityIdentity &cliIdentity) const;
......
......@@ -743,7 +743,7 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, createUser) {
catalogue::SqliteCatalogue catalogue;
ASSERT_TRUE(catalogue.getUsers().empty());
ASSERT_TRUE(catalogue.getRequesters().empty());
const std::string mountGroupName = "mount_group";
const uint64_t archivePriority = 1;
......@@ -764,13 +764,17 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, createUser) {
const std::string comment = "create user";
const std::string userName = "user_name";
catalogue.createUser(m_cliSI, userName, mountGroupName, comment);
std::list<common::dataStructures::User> users;
users = catalogue.getUsers();
const std::string group = "group";
cta::common::dataStructures::UserIdentity userIdentity;
userIdentity.name=userName;
userIdentity.group=group;
catalogue.createRequester(m_cliSI, userIdentity, mountGroupName, comment);
std::list<common::dataStructures::Requester> users;
users = catalogue.getRequesters();
ASSERT_EQ(1, users.size());
const common::dataStructures::User user = users.front();
const common::dataStructures::Requester user = users.front();
ASSERT_EQ(userName, user.name);
ASSERT_EQ(mountGroupName, user.mountGroupName);
......@@ -780,14 +784,14 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, createUser) {
ASSERT_EQ(user.creationLog, user.lastModificationLog);
const common::dataStructures::MountPolicy archivePolicy =
catalogue.getArchiveMountPolicy(userName);
catalogue.getArchiveMountPolicy(userIdentity);
ASSERT_EQ(archivePriority, archivePolicy.priority);
ASSERT_EQ(minArchiveRequestAge, archivePolicy.minRequestAge);
ASSERT_EQ(maxDrivesAllowed, archivePolicy.maxDrives);
const common::dataStructures::MountPolicy retrievePolicy =
catalogue.getRetrieveMountPolicy(userName);
catalogue.getRetrieveMountPolicy(userIdentity);
ASSERT_EQ(retrievePriority, retrievePolicy.priority);
ASSERT_EQ(minRetrieveRequestAge, retrievePolicy.minRequestAge);
......@@ -799,7 +803,7 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, createUser_same_twice) {
catalogue::SqliteCatalogue catalogue;
ASSERT_TRUE(catalogue.getUsers().empty());
ASSERT_TRUE(catalogue.getRequesters().empty());
const std::string mountGroupName = "mount_group";
const uint64_t archivePriority = 1;
......@@ -821,8 +825,12 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, createUser_same_twice) {
const std::string comment = "create user";
const std::string name = "name";
const std::string mountGroup = "mount_group";
catalogue.createUser(m_cliSI, name, mountGroup, comment);
ASSERT_THROW(catalogue.createUser(m_cliSI, name, mountGroup, comment),
const std::string group = "group";
cta::common::dataStructures::UserIdentity userIdentity;
userIdentity.name=name;
userIdentity.group=group;
catalogue.createRequester(m_cliSI, userIdentity, mountGroupName, comment);
ASSERT_THROW(catalogue.createRequester(m_cliSI, userIdentity, mountGroup, comment),
exception::Exception);
}
......@@ -907,7 +915,7 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, prepareForNewFile) {
catalogue::SqliteCatalogue catalogue;
ASSERT_TRUE(catalogue.getUsers().empty());
ASSERT_TRUE(catalogue.getRequesters().empty());
const std::string mountGroupName = "mount_group";
const uint64_t archivePriority = 1;
......@@ -928,13 +936,17 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, prepareForNewFile) {
const std::string userComment = "create user";
const std::string userName = "user_name";
catalogue.createUser(m_cliSI, userName, mountGroupName, userComment);
std::list<common::dataStructures::User> users;
users = catalogue.getUsers();
const std::string group = "group";
cta::common::dataStructures::UserIdentity userIdentity;
userIdentity.name=userName;
userIdentity.group=group;
catalogue.createRequester(m_cliSI, userIdentity, mountGroupName, userComment);
std::list<common::dataStructures::Requester> users;
users = catalogue.getRequesters();
ASSERT_EQ(1, users.size());
const common::dataStructures::User user = users.front();
const common::dataStructures::Requester user = users.front();
ASSERT_EQ(userName, user.name);
ASSERT_EQ(mountGroupName, user.mountGroupName);
......@@ -944,14 +956,14 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, prepareForNewFile) {
ASSERT_EQ(user.creationLog, user.lastModificationLog);
const common::dataStructures::MountPolicy archivePolicy =
catalogue.getArchiveMountPolicy(userName);
catalogue.getArchiveMountPolicy(userIdentity);
ASSERT_EQ(archivePriority, archivePolicy.priority);
ASSERT_EQ(minArchiveRequestAge, archivePolicy.minRequestAge);
ASSERT_EQ(maxDrivesAllowed, archivePolicy.maxDrives);
const common::dataStructures::MountPolicy retrievePolicy =
catalogue.getRetrieveMountPolicy(userName);
catalogue.getRetrieveMountPolicy(userIdentity);
ASSERT_EQ(retrievePriority, retrievePolicy.priority);
ASSERT_EQ(minRetrieveRequestAge, retrievePolicy.minRequestAge);
......@@ -1003,7 +1015,7 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, prepareForNewFile) {
ASSERT_EQ(tapePoolName, maplet.second);
const common::dataStructures::ArchiveFileQueueCriteria queueCriteria =
catalogue.prepareForNewFile(storageClassName, userName);
catalogue.prepareForNewFile(storageClassName, userIdentity);
ASSERT_EQ(1, queueCriteria.fileId);
ASSERT_EQ(1, queueCriteria.copyToPoolMap.size());
......
......@@ -46,6 +46,7 @@ set (COMMON_LIB_SRC_FILES
dataStructures/ReadTestResult.cpp
dataStructures/RepackInfo.cpp
dataStructures/RepackType.cpp
dataStructures/Requester.cpp
dataStructures/RetrieveJob.cpp
dataStructures/RetrieveRequest.cpp
dataStructures/SecurityIdentity.cpp
......@@ -56,7 +57,6 @@ set (COMMON_LIB_SRC_FILES
dataStructures/TapePool.cpp
dataStructures/TestSourceType.cpp
dataStructures/UpdateFileInfoRequest.cpp
dataStructures/User.cpp
dataStructures/UserIdentity.cpp
dataStructures/VerifyInfo.cpp
dataStructures/WriteTestResult.cpp
......
......@@ -16,19 +16,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common/dataStructures/User.hpp"
#include "common/dataStructures/Requester.hpp"
#include "common/dataStructures/utils.hpp"
#include "common/exception/Exception.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::common::dataStructures::User::User() {}
cta::common::dataStructures::Requester::Requester() {}
//------------------------------------------------------------------------------
// operator==
//------------------------------------------------------------------------------
bool cta::common::dataStructures::User::operator==(const User &rhs) const {
bool cta::common::dataStructures::Requester::operator==(const Requester &rhs) const {
return name==rhs.name
&& group==rhs.group
&& mountGroupName==rhs.mountGroupName
......@@ -40,14 +40,14 @@ bool cta::common::dataStructures::User::operator==(const User &rhs) const {
//------------------------------------------------------------------------------
// operator!=
//------------------------------------------------------------------------------
bool cta::common::dataStructures::User::operator!=(const User &rhs) const {
bool cta::common::dataStructures::Requester::operator!=(const Requester &rhs) const {
return !operator==(rhs);
}
//------------------------------------------------------------------------------
// operator<<
//------------------------------------------------------------------------------
std::ostream &operator<<(std::ostream &os, const cta::common::dataStructures::User &obj) {
std::ostream &operator<<(std::ostream &os, const cta::common::dataStructures::Requester &obj) {
os << "(name=" << obj.name
<< " group=" << obj.group
<< " mountGroupName=" << obj.mountGroupName
......
......@@ -30,15 +30,15 @@ namespace common {
namespace dataStructures {
/*
* This is the disk system user that triggered the retrieve/archive request
* This is the disk system user that triggered the request (any of: archival, retrieval, deletion of an archive file, cancel of an ongoing retrieval, update of a file metadata, listing of storage classes). It may or may not be the owner of the file (basically there's no relationship between the two)
*/
struct User {
struct Requester {
User();
Requester();
bool operator==(const User &rhs) const;
bool operator==(const Requester &rhs) const;
bool operator!=(const User &rhs) const;
bool operator!=(const Requester &rhs) const;
std::string name;
std::string group;
......@@ -47,10 +47,10 @@ struct User {
cta::common::dataStructures::EntryLog lastModificationLog;
std::string comment;
}; // struct User
}; // struct Requester
} // namespace dataStructures
} // namespace common
} // namespace cta
std::ostream &operator<<(std::ostream &os, const cta::common::dataStructures::User &obj);
std::ostream &operator<<(std::ostream &os, const cta::common::dataStructures::Requester &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. EOS only has 5 instances: Alice, Atlas, Cms, Lhcb
and Public. See the VOs.txt file for more details on how these are used for limiting the crosstalk.
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.
**********ARCHIVING from EOS to CTA**********
1) EOS REQUEST: cta a/archive --encoded <"true" or "false"> // true if all following arguments are base64 encoded
--user <user> // string name of the requester of the action, used for SLAs and logging, not kept by CTA after successful operation
--group <group> // string group of the requester of the action, used for SLAs and logging, not kept by CTA after successful operation
1) EOS REQUEST: cta a/archive --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 (archival), used for SLAs and logging, not kept by CTA after successful operation
--group <group> // string group of the requester of the action (archival), used for SLAs and logging, not kept by CTA after successful operation
--diskid <disk_id> // string disk id of the file to be archived, kept by CTA for reconciliation purposes
--instance <instance> // string kept by CTA for authorizing the request and for disaster recovery
--srcurl <src_URL> // string of the form scheme://host:port/opaque_part, not kept by CTA after successful archival
......@@ -34,9 +34,9 @@ CTA_ArchiveFileID: string which is the unique ID of the CTA file to be kept by E
**********RETRIEVING from CTA to EOS**********
1) EOS REQUEST: cta r/retrieve --encoded <"true" or "false"> // true if all following arguments are base64 encoded
--user <user> // string name of the requester of the action, used for SLAs and logging, not kept by CTA after successful operation
--group <group> // string group of the requester of the action, used for SLAs and logging, not kept by CTA after successful operation
1) EOS REQUEST: cta r/retrieve --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 (retrieval), used for SLAs and logging, not kept by CTA after successful operation
--group <group> // string group of the requester of the action (retrieval), used for SLAs and logging, not kept by CTA after successful operation
--id <CTA_ArchiveFileID> // uint64_t which is the unique ID of the CTA file
--dsturl <dst_URL> // string of the form scheme://host:port/opaque_part (NOT kept by CTA after successful archival)
--dr_path <DR_path> // string kept by CTA for disaster recovery and for logging
......@@ -56,9 +56,9 @@ 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
--user <user> // string name of the requester of the action, used for SLAs and logging, not kept by CTA after successful operation
--group <group> // string group of the requester of the action, used for SLAs and logging, not kept by CTA after successful operation
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
Note: This command may be issued even before the actual archival process has begun
......@@ -67,9 +67,9 @@ 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
--user <user> // string name of the requester of the action, used for SLAs and logging, not kept by CTA after successful operation
--group <group> // string group of the requester of the action, used for SLAs and logging, not kept by CTA after successful operation
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
--dsturl <dst_URL> // this is the same string provided in the EOS retrieval request
--dr_path <DR_path> // string kept by CTA for disaster recovery and for logging
......@@ -84,9 +84,9 @@ Note: DR info is piggybacked
**********UPDATE INFO of a FILE**********
1) EOS REQUEST: cta ufi/updatefileinfo --encoded <\"true\" or \"false\"> // true if all following arguments are base64 encoded
--user <user> // string name of the requester of the action, used for SLAs and logging, not kept by CTA after successful operation
--group <group> // string group of the requester of the action, used for SLAs and 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)
--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
......@@ -100,8 +100,8 @@ Note: This command DOES NOT change the number of tape copies! The number will ch
**********LISTING all STORAGE CLASSES available**********
1) EOS REQUEST: cta lsc/liststorageclass --encoded <\"true\" or \"false\"> // true if all following arguments are base64 encoded
--user <user> // string name of the requester of the action, used for SLAs and logging, not kept by CTA after successful operation
--group <group> // string group of the requester of the action, used for SLAs and logging, not kept by CTA after successful operation
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 r