Commit 9d54146a authored by Steven Murray's avatar Steven Murray
Browse files

Improved the SQLite SQL

parent 505874f4
......@@ -108,12 +108,12 @@ public:
virtual void modifyArchiveRouteTapePoolName(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &storageClassName, const uint64_t copyNb, const std::string &tapePoolName) = 0;
virtual void modifyArchiveRouteComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &storageClassName, const uint64_t copyNb, const std::string &comment) = 0;
virtual void createLogicalLibrary(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t minarchivebytesqueued, const uint64_t minretrievebytesqueued, const std::string &comment) = 0;
virtual void createLogicalLibrary(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t archiveMinBytesQueued, const uint64_t retrieveMinBytesQueued, const std::string &comment) = 0;
virtual void deleteLogicalLibrary(const std::string &name) = 0;
virtual std::list<cta::common::dataStructures::LogicalLibrary> getLogicalLibraries() const = 0;
virtual void modifyLogicalLibraryComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &comment) = 0;
virtual void modifyLogicalLibraryMinArchiveBytesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, uint64_t const minarchivebytesqueued) = 0;
virtual void modifyLogicalLibraryMinRetrieveBytesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, uint64_t const minretrievebytesqueued) = 0;
virtual void modifyLogicalLibraryMinArchiveBytesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, uint64_t const archiveMinBytesQueued) = 0;
virtual void modifyLogicalLibraryMinRetrieveBytesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, uint64_t const retrieveMinBytesQueued) = 0;
virtual void createTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName,
const std::string &encryptionKey, const uint64_t capacityInBytes, const bool disabledValue, const bool fullValue, const std::string &comment) = 0;
......@@ -154,11 +154,11 @@ public:
virtual std::list<cta::common::dataStructures::MountGroup> getMountGroups() const = 0;
virtual void modifyMountGroupArchivePriority(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t archivePriority) = 0;
virtual void modifyMountGroupArchiveMinFilesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t minArchiveFilesQueued) = 0;
virtual void modifyMountGroupArchiveMinBytesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t minArchiveBytesQueued) = 0;
virtual void modifyMountGroupArchiveMinBytesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t archiveMinBytesQueued) = 0;
virtual void modifyMountGroupArchiveMinRequestAge(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t minArchiveRequestAge) = 0;
virtual void modifyMountGroupRetrievePriority(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t retrievePriority) = 0;
virtual void modifyMountGroupRetrieveMinFilesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t minRetrieveFilesQueued) = 0;
virtual void modifyMountGroupRetrieveMinBytesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t minRetrieveBytesQueued) = 0;
virtual void modifyMountGroupRetrieveMinBytesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t retrieveMinBytesQueued) = 0;
virtual void modifyMountGroupRetrieveMinRequestAge(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t minRetrieveRequestAge) = 0;
virtual void modifyMountGroupMaxDrivesAllowed(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t maxDrivesAllowed) = 0;
virtual void modifyMountGroupComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &comment) = 0;
......
......@@ -54,7 +54,7 @@ void cta::catalogue::SqliteCatalogue::createDbSchema() {
"LAST_MOD_HOST_NAME VARCHAR2(100) NOT NULL,"
"LAST_MOD_TIME INTEGER NOT NULL,"
"PRIMARY KEY(ADMIN_USER_NAME)"
"CONSTRAINT ADMIN_USER_PK PRIMARY KEY(ADMIN_USER_NAME)"
");"
"CREATE TABLE ADMIN_HOST("
......@@ -140,7 +140,9 @@ void cta::catalogue::SqliteCatalogue::createDbSchema() {
");"
"CREATE TABLE LOGICAL_LIBRARY("
"LOGICAL_LIBRARY_NAME VARCHAR2(100) NOT NULL,"
"LOGICAL_LIBRARY_NAME VARCHAR2(100) NOT NULL,"
"ARCHIVE_MIN_BYTES_QUEUED INTEGER NOT NULL,"
"RETRIEVE_MIN_BYTES_QUEUED INTEGER NOT NULL,"
"USER_COMMENT VARCHAR2(1000) NOT NULL,"
......@@ -201,15 +203,11 @@ void cta::catalogue::SqliteCatalogue::createDbSchema() {
"CREATE TABLE MOUNT_GROUP("
"MOUNT_GROUP_NAME VARCHAR2(100) NOT NULL,"
"ARCHIVE_PRIORITY INTEGER NOT NULL,"
"MIN_ARCHIVE_FILES_QUEUED INTEGER NOT NULL,"
"MIN_ARCHIVE_BYTES_QUEUED INTEGER NOT NULL,"
"MIN_ARCHIVE_REQUEST_AGE INTEGER NOT NULL,"
"ARCHIVE_PRIORITY INTEGER NOT NULL,"
"ARCHIVE_MIN_REQUEST_AGE INTEGER NOT NULL,"
"RETRIEVE_PRIORITY INTEGER NOT NULL,"
"MIN_RETRIEVE_FILES_QUEUED INTEGER NOT NULL,"
"MIN_RETRIEVE_BYTES_QUEUED INTEGER NOT NULL,"
"MIN_RETRIEVE_REQUEST_AGE INTEGER NOT NULL,"
"RETRIEVE_PRIORITY INTEGER NOT NULL,"
"RETRIEVE_MIN_REQUEST_AGE INTEGER NOT NULL,"
"MAX_DRIVES_ALLOWED INTEGER NOT NULL,"
......@@ -979,13 +977,15 @@ void cta::catalogue::SqliteCatalogue::modifyArchiveRouteComment(const common::da
void cta::catalogue::SqliteCatalogue::createLogicalLibrary(
const common::dataStructures::SecurityIdentity &cliIdentity,
const std::string &name,
const uint64_t minarchivebytesqueued,
const uint64_t minretrievebytesqueued,
const uint64_t archiveMinBytesQueued,
const uint64_t retrieveMinBytesQueued,
const std::string &comment) {
const time_t now = time(NULL);
const char *const sql =
"INSERT INTO LOGICAL_LIBRARY("
"LOGICAL_LIBRARY_NAME,"
"ARCHIVE_MIN_BYTES_QUEUED,"
"RETRIEVE_MIN_BYTES_QUEUED,"
"USER_COMMENT,"
......@@ -1000,6 +1000,8 @@ void cta::catalogue::SqliteCatalogue::createLogicalLibrary(
"LAST_MOD_TIME)"
"VALUES("
":LOGICAL_LIBRARY_NAME,"
":ARCHIVE_MIN_BYTES_QUEUED,"
":RETRIEVE_MIN_BYTES_QUEUED,"
":USER_COMMENT,"
......@@ -1015,6 +1017,8 @@ void cta::catalogue::SqliteCatalogue::createLogicalLibrary(
std::unique_ptr<SqliteStmt> stmt(m_conn.createStmt(sql));
stmt->bind(":LOGICAL_LIBRARY_NAME", name);
stmt->bind(":ARCHIVE_MIN_BYTES_QUEUED", archiveMinBytesQueued);
stmt->bind(":RETRIEVE_MIN_BYTES_QUEUED", retrieveMinBytesQueued);
stmt->bind(":USER_COMMENT", comment);
......@@ -1039,7 +1043,9 @@ std::list<cta::common::dataStructures::LogicalLibrary>
std::list<cta::common::dataStructures::LogicalLibrary> libs;
const char *const sql =
"SELECT "
"LOGICAL_LIBRARY_NAME AS LOGICAL_LIBRARY_NAME,"
"LOGICAL_LIBRARY_NAME AS LOGICAL_LIBRARY_NAME,"
"ARCHIVE_MIN_BYTES_QUEUED AS ARCHIVE_MIN_BYTES_QUEUED,"
"RETRIEVE_MIN_BYTES_QUEUED AS RETRIEVE_MIN_BYTES_QUEUED,"
"USER_COMMENT AS USER_COMMENT,"
......@@ -1062,6 +1068,8 @@ std::list<cta::common::dataStructures::LogicalLibrary>
common::dataStructures::LogicalLibrary lib;
lib.name = stmt->columnText(nameToIdx["LOGICAL_LIBRARY_NAME"]);
lib.archiveMinBytesQueued = stmt->columnUint64(nameToIdx["ARCHIVE_MIN_BYTES_QUEUED"]);
lib.retrieveMinBytesQueued = stmt->columnUint64(nameToIdx["RETRIEVE_MIN_BYTES_QUEUED"]);
lib.comment = stmt->columnText(nameToIdx["USER_COMMENT"]);
......@@ -1101,12 +1109,12 @@ void cta::catalogue::SqliteCatalogue::modifyLogicalLibraryComment(const common::
//------------------------------------------------------------------------------
// modifyLogicalLibraryComment
//------------------------------------------------------------------------------
void cta::catalogue::SqliteCatalogue::modifyLogicalLibraryMinArchiveBytesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, uint64_t const minarchivebytesqueued) {}
void cta::catalogue::SqliteCatalogue::modifyLogicalLibraryMinArchiveBytesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, uint64_t const archiveMinBytesQueued) {}
//------------------------------------------------------------------------------
// modifyLogicalLibraryComment
//------------------------------------------------------------------------------
void cta::catalogue::SqliteCatalogue::modifyLogicalLibraryMinRetrieveBytesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, uint64_t const minretrievebytesqueued) {}
void cta::catalogue::SqliteCatalogue::modifyLogicalLibraryMinRetrieveBytesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, uint64_t const retrieveMinBytesQueued) {}
//------------------------------------------------------------------------------
// createTape
......@@ -1560,10 +1568,10 @@ void cta::catalogue::SqliteCatalogue::createMountGroup(
"MOUNT_GROUP_NAME,"
"ARCHIVE_PRIORITY,"
"MIN_ARCHIVE_REQUEST_AGE,"
"ARCHIVE_MIN_REQUEST_AGE,"
"RETRIEVE_PRIORITY,"
"MIN_RETRIEVE_REQUEST_AGE,"
"RETRIEVE_MIN_REQUEST_AGE,"
"MAX_DRIVES_ALLOWED,"
......@@ -1582,10 +1590,10 @@ void cta::catalogue::SqliteCatalogue::createMountGroup(
":MOUNT_GROUP_NAME,"
":ARCHIVE_PRIORITY,"
":MIN_ARCHIVE_REQUEST_AGE,"
":ARCHIVE_MIN_REQUEST_AGE,"
":RETRIEVE_PRIORITY,"
":MIN_RETRIEVE_REQUEST_AGE,"
":RETRIEVE_MIN_REQUEST_AGE,"
":MAX_DRIVES_ALLOWED,"
......@@ -1605,10 +1613,10 @@ void cta::catalogue::SqliteCatalogue::createMountGroup(
stmt->bind(":MOUNT_GROUP_NAME", name);
stmt->bind(":ARCHIVE_PRIORITY", archivePriority);
stmt->bind(":MIN_ARCHIVE_REQUEST_AGE", minArchiveRequestAge);
stmt->bind(":ARCHIVE_MIN_REQUEST_AGE", minArchiveRequestAge);
stmt->bind(":RETRIEVE_PRIORITY", retrievePriority);
stmt->bind(":MIN_RETRIEVE_REQUEST_AGE", minRetrieveRequestAge);
stmt->bind(":RETRIEVE_MIN_REQUEST_AGE", minRetrieveRequestAge);
stmt->bind(":MAX_DRIVES_ALLOWED", maxDrivesAllowed);
......@@ -1638,10 +1646,10 @@ std::list<cta::common::dataStructures::MountGroup>
"MOUNT_GROUP_NAME AS MOUNT_GROUP_NAME,"
"ARCHIVE_PRIORITY AS ARCHIVE_PRIORITY,"
"MIN_ARCHIVE_REQUEST_AGE AS MIN_ARCHIVE_REQUEST_AGE,"
"ARCHIVE_MIN_REQUEST_AGE AS ARCHIVE_MIN_REQUEST_AGE,"
"RETRIEVE_PRIORITY AS RETRIEVE_PRIORITY,"
"MIN_RETRIEVE_REQUEST_AGE AS MIN_RETRIEVE_REQUEST_AGE,"
"RETRIEVE_MIN_REQUEST_AGE AS RETRIEVE_MIN_REQUEST_AGE,"
"MAX_DRIVES_ALLOWED AS MAX_DRIVES_ALLOWED,"
......@@ -1669,12 +1677,12 @@ std::list<cta::common::dataStructures::MountGroup>
group.archive_priority = stmt->columnUint64(nameToIdx["ARCHIVE_PRIORITY"]);
group.archive_minRequestAge =
stmt->columnUint64(nameToIdx["MIN_ARCHIVE_REQUEST_AGE"]);
stmt->columnUint64(nameToIdx["ARCHIVE_MIN_REQUEST_AGE"]);
group.retrieve_priority =
stmt->columnUint64(nameToIdx["RETRIEVE_PRIORITY"]);
group.retrieve_minRequestAge =
stmt->columnUint64(nameToIdx["MIN_RETRIEVE_REQUEST_AGE"]);
stmt->columnUint64(nameToIdx["RETRIEVE_MIN_REQUEST_AGE"]);
group.maxDrivesAllowed =
stmt->columnUint64(nameToIdx["MAX_DRIVES_ALLOWED"]);
......@@ -1722,7 +1730,7 @@ void cta::catalogue::SqliteCatalogue::modifyMountGroupArchiveMinFilesQueued(cons
//------------------------------------------------------------------------------
// modifyMountGroupArchiveMinBytesQueued
//------------------------------------------------------------------------------
void cta::catalogue::SqliteCatalogue::modifyMountGroupArchiveMinBytesQueued(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t minArchiveBytesQueued) {}
void cta::catalogue::SqliteCatalogue::modifyMountGroupArchiveMinBytesQueued(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t archiveMinBytesQueued) {}
//------------------------------------------------------------------------------
// modifyMountGroupArchiveMinRequestAge
......@@ -1742,7 +1750,7 @@ void cta::catalogue::SqliteCatalogue::modifyMountGroupRetrieveMinFilesQueued(con
//------------------------------------------------------------------------------
// modifyMountGroupRetrieveMinBytesQueued
//------------------------------------------------------------------------------
void cta::catalogue::SqliteCatalogue::modifyMountGroupRetrieveMinBytesQueued(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t minRetrieveBytesQueued) {}
void cta::catalogue::SqliteCatalogue::modifyMountGroupRetrieveMinBytesQueued(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t retrieveMinBytesQueued) {}
//------------------------------------------------------------------------------
// modifyMountGroupRetrieveMinRequestAge
......@@ -2112,8 +2120,8 @@ cta::common::dataStructures::MountPolicy cta::catalogue::SqliteCatalogue::
getArchiveMountPolicy(const std::string &user) const {
const char *const sql =
"SELECT "
"ARCHIVE_PRIORITY AS ARCHIVE_PRIORITY,"
"MIN_ARCHIVE_REQUEST_AGE AS MIN_ARCHIVE_REQUEST_AGE,"
"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 "
......@@ -2127,7 +2135,7 @@ cta::common::dataStructures::MountPolicy cta::catalogue::SqliteCatalogue::
nameToIdx = stmt->getColumnNameToIdx();
common::dataStructures::MountPolicy policy;
policy.priority = stmt->columnUint64(nameToIdx["ARCHIVE_PRIORITY"]);
policy.minRequestAge = stmt->columnUint64(nameToIdx["MIN_ARCHIVE_REQUEST_AGE"]);
policy.minRequestAge = stmt->columnUint64(nameToIdx["ARCHIVE_MIN_REQUEST_AGE"]);
policy.maxDrives = stmt->columnUint64(nameToIdx["MAX_DRIVES_ALLOWED"]);
return policy;
} else {
......@@ -2145,8 +2153,8 @@ cta::common::dataStructures::MountPolicy cta::catalogue::SqliteCatalogue::
getRetrieveMountPolicy(const std::string &user) const {
const char *const sql =
"SELECT "
"RETRIEVE_PRIORITY AS RETRIEVE_PRIORITY,"
"MIN_RETRIEVE_REQUEST_AGE AS MIN_RETRIEVE_REQUEST_AGE,"
"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 "
......@@ -2160,7 +2168,7 @@ cta::common::dataStructures::MountPolicy cta::catalogue::SqliteCatalogue::
nameToIdx = stmt->getColumnNameToIdx();
common::dataStructures::MountPolicy policy;
policy.priority = stmt->columnUint64(nameToIdx["RETRIEVE_PRIORITY"]);
policy.minRequestAge = stmt->columnUint64(nameToIdx["MIN_RETRIEVE_REQUEST_AGE"]);
policy.minRequestAge = stmt->columnUint64(nameToIdx["RETRIEVE_MIN_REQUEST_AGE"]);
policy.maxDrives = stmt->columnUint64(nameToIdx["MAX_DRIVES_ALLOWED"]);
return policy;
} else {
......
......@@ -72,12 +72,12 @@ public:
virtual void modifyArchiveRouteTapePoolName(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &storageClassName, const uint64_t copyNb, const std::string &tapePoolName);
virtual void modifyArchiveRouteComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &storageClassName, const uint64_t copyNb, const std::string &comment);
virtual void createLogicalLibrary(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t minarchivebytesqueued, const uint64_t minretrievebytesqueued, const std::string &comment);
virtual void createLogicalLibrary(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t archiveMinBytesQueued, const uint64_t retrieveMinBytesQueued, const std::string &comment);
virtual void deleteLogicalLibrary(const std::string &name);
virtual std::list<cta::common::dataStructures::LogicalLibrary> getLogicalLibraries() const;
virtual void modifyLogicalLibraryComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &comment);
virtual void modifyLogicalLibraryMinArchiveBytesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, uint64_t const minarchivebytesqueued);
virtual void modifyLogicalLibraryMinRetrieveBytesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, uint64_t const minretrievebytesqueued);
virtual void modifyLogicalLibraryMinArchiveBytesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, uint64_t const archiveMinBytesQueued);
virtual void modifyLogicalLibraryMinRetrieveBytesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, uint64_t const retrieveMinBytesQueued);
virtual void createTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName,
const std::string &encryptionKey, const uint64_t capacityInBytes, const bool disabledValue, const bool fullValue, const std::string &comment);
......@@ -118,11 +118,11 @@ public:
virtual std::list<cta::common::dataStructures::MountGroup> getMountGroups() const;
virtual void modifyMountGroupArchivePriority(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t archivePriority);
virtual void modifyMountGroupArchiveMinFilesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t minArchiveFilesQueued);
virtual void modifyMountGroupArchiveMinBytesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t minArchiveBytesQueued);
virtual void modifyMountGroupArchiveMinBytesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t archiveMinBytesQueued);
virtual void modifyMountGroupArchiveMinRequestAge(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t minArchiveRequestAge);
virtual void modifyMountGroupRetrievePriority(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t retrievePriority);
virtual void modifyMountGroupRetrieveMinFilesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t minRetrieveFilesQueued);
virtual void modifyMountGroupRetrieveMinBytesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t minRetrieveBytesQueued);
virtual void modifyMountGroupRetrieveMinBytesQueued(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t retrieveMinBytesQueued);
virtual void modifyMountGroupRetrieveMinRequestAge(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t minRetrieveRequestAge);
virtual void modifyMountGroupMaxDrivesAllowed(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t maxDrivesAllowed);
virtual void modifyMountGroupComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &comment);
......
......@@ -536,9 +536,9 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, createLogicalLibrary) {
const std::string logicalLibraryName = "logical_library";
const std::string comment = "create logical library";
const uint64_t minArchiveBytesQueued = 1;
const uint64_t minRetrieveBytesQueued = 2;
catalogue.createLogicalLibrary(m_cliSI, logicalLibraryName, minArchiveBytesQueued, minRetrieveBytesQueued, comment);
const uint64_t archiveMinBytesQueued = 1;
const uint64_t retrieveMinBytesQueued = 2;
catalogue.createLogicalLibrary(m_cliSI, logicalLibraryName, archiveMinBytesQueued, retrieveMinBytesQueued, comment);
const std::list<common::dataStructures::LogicalLibrary> libs =
catalogue.getLogicalLibraries();
......@@ -548,8 +548,8 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, createLogicalLibrary) {
const common::dataStructures::LogicalLibrary lib = libs.front();
ASSERT_EQ(logicalLibraryName, lib.name);
ASSERT_EQ(comment, lib.comment);
ASSERT_EQ(minArchiveBytesQueued, lib.archive_minBytesQueued);
ASSERT_EQ(minRetrieveBytesQueued, lib.retrieve_minBytesQueued);
ASSERT_EQ(archiveMinBytesQueued, lib.archiveMinBytesQueued);
ASSERT_EQ(retrieveMinBytesQueued, lib.retrieveMinBytesQueued);
const common::dataStructures::EntryLog creationLog = lib.creationLog;
ASSERT_EQ(m_cliSI.user.name, creationLog.user.name);
......@@ -568,11 +568,11 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, createLogicalLibrary_same_twice) {
const std::string logicalLibraryName = "logical_library";
const std::string comment = "create logical library";
const uint64_t minArchiveBytesQueued = 1;
const uint64_t minRetrieveBytesQueued = 2;
catalogue.createLogicalLibrary(m_cliSI, logicalLibraryName, minArchiveBytesQueued, minRetrieveBytesQueued, comment);
const uint64_t archiveMinBytesQueued = 1;
const uint64_t retrieveMinBytesQueued = 2;
catalogue.createLogicalLibrary(m_cliSI, logicalLibraryName, archiveMinBytesQueued, retrieveMinBytesQueued, comment);
ASSERT_THROW(catalogue.createLogicalLibrary(m_cliSI,
logicalLibraryName, minArchiveBytesQueued, minRetrieveBytesQueued, comment),
logicalLibraryName, archiveMinBytesQueued, retrieveMinBytesQueued, comment),
exception::Exception);
}
......
......@@ -28,7 +28,7 @@ CREATE TABLE ADMIN_USER(
LAST_MOD_HOST_NAME VARCHAR2(100) NOT NULL,
LAST_MOD_TIME INTEGER NOT NULL,
PRIMARY KEY(ADMIN_USER_NAME)
CONSTRAINT ADMIN_USER_PK PRIMARY KEY(ADMIN_USER_NAME)
);
CREATE TABLE ADMIN_HOST(
......@@ -46,7 +46,7 @@ CREATE TABLE ADMIN_HOST(
LAST_MOD_HOST_NAME VARCHAR2(100) NOT NULL,
LAST_MOD_TIME INTEGER NOT NULL,
PRIMARY KEY(ADMIN_HOST_NAME)
CONSTRAINT ADMIN_HOST_PK PRIMARY KEY(ADMIN_HOST_NAME)
);
CREATE TABLE STORAGE_CLASS(
......@@ -65,7 +65,7 @@ CREATE TABLE STORAGE_CLASS(
LAST_MOD_HOST_NAME VARCHAR2(100) NOT NULL,
LAST_MOD_TIME INTEGER NOT NULL,
PRIMARY KEY(STORAGE_CLASS_NAME)
CONSTRAINT STORAGE_CLASS_PK PRIMARY KEY(STORAGE_CLASS_NAME)
);
CREATE TABLE TAPE_POOL(
......@@ -85,7 +85,7 @@ CREATE TABLE TAPE_POOL(
LAST_MOD_HOST_NAME VARCHAR2(100) NOT NULL,
LAST_MOD_TIME INTEGER NOT NULL,
PRIMARY KEY(TAPE_POOL_NAME)
CONSTRAINT TAPE_POOL_PK PRIMARY KEY(TAPE_POOL_NAME)
);
CREATE TABLE ARCHIVE_ROUTE(
......@@ -105,16 +105,18 @@ CREATE TABLE ARCHIVE_ROUTE(
LAST_MOD_HOST_NAME VARCHAR2(100) NOT NULL,
LAST_MOD_TIME INTEGER NOT NULL,
PRIMARY KEY(STORAGE_CLASS_NAME, COPY_NB),
FOREIGN KEY(STORAGE_CLASS_NAME) REFERENCES
STORAGE_CLASS(STORAGE_CLASS_NAME),
FOREIGN KEY(TAPE_POOL_NAME) REFERENCES
TAPE_POOL(TAPE_POOL_NAME)
CONSTRAINT ARCHIVE_ROUTE_PK PRIMARY KEY(STORAGE_CLASS_NAME, COPY_NB),
CONSTRAINT ARCHIVE_ROUTE_STORAGE_CLASS_FK FOREIGN KEY(STORAGE_CLASS_NAME)
REFERENCES STORAGE_CLASS(STORAGE_CLASS_NAME),
CONSTRAINT ARCHIVE_ROUTE_TAPE_POOL_FK FOREIGN KEY(TAPE_POOL_NAME)
REFERENCES TAPE_POOL(TAPE_POOL_NAME)
);
CREATE TABLE LOGICAL_LIBRARY(
LOGICAL_LIBRARY_NAME VARCHAR2(100) NOT NULL,
LOGICAL_LIBRARY_NAME VARCHAR2(100) NOT NULL,
ARCHIVE_MIN_BYTES_QUEUED INTEGER NOT NULL,
RETRIEVE_MIN_BYTES_QUEUED INTEGER NOT NULL,
USER_COMMENT VARCHAR2(1000) NOT NULL,
......@@ -128,7 +130,7 @@ CREATE TABLE LOGICAL_LIBRARY(
LAST_MOD_HOST_NAME VARCHAR2(100) NOT NULL,
LAST_MOD_TIME INTEGER NOT NULL,
PRIMARY KEY(LOGICAL_LIBRARY_NAME)
CONSTRAINT LOGICAL_LIBRARY_PK PRIMARY KEY(LOGICAL_LIBRARY_NAME)
);
CREATE TABLE TAPE(
......@@ -136,14 +138,13 @@ CREATE TABLE TAPE(
LOGICAL_LIBRARY_NAME VARCHAR2(100) NOT NULL,
TAPE_POOL_NAME VARCHAR2(100) NOT NULL,
ENCRYPTION_KEY VARCHAR2(100) NOT NULL,
CAPACITY_IN_BYTES INTEGER NOT NULL,
DATA_IN_BYTES INTEGER NOT NULL,
LAST_FSEQ INTEGER NOT NULL,
IS_BUSY INTEGER NOT NULL,
IS_DISABLED INTEGER NOT NULL,
IS_FULL INTEGER NOT NULL,
LBP_IS_ON INTEGER NOT NULL,
CAPACITY_IN_BYTES INTEGER NOT NULL,
DATA_IN_BYTES INTEGER NOT NULL,
LAST_FSEQ INTEGER NOT NULL,
IS_BUSY INTEGER NOT NULL,
IS_DISABLED INTEGER NOT NULL,
IS_FULL INTEGER NOT NULL,
LBP_IS_ON INTEGER NOT NULL,
LABEL_DRIVE VARCHAR2(100) NOT NULL,
LABEL_TIME INTEGER NOT NULL,
......@@ -165,25 +166,22 @@ CREATE TABLE TAPE(
LAST_MOD_HOST_NAME VARCHAR2(100) NOT NULL,
LAST_MOD_TIME INTEGER NOT NULL,
PRIMARY KEY(VID),
FOREIGN KEY(LOGICAL_LIBRARY_NAME) REFERENCES
LOGICAL_LIBRARY(LOGICAL_LIBRARY_NAME),
FOREIGN KEY(TAPE_POOL_NAME) REFERENCES
TAPE_POOL(TAPE_POOL_NAME)
CONSTRAINT TAPE_PK PRIMARY KEY(VID),
CONSTRAINT TAPE_LOGICAL_LIBRARY_FK FOREIGN KEY(LOGICAL_LIBRARY_NAME)
REFERENCES LOGICAL_LIBRARY(LOGICAL_LIBRARY_NAME),
CONSTRAINT TAPE_TAPE_POOL_FK FOREIGN KEY(TAPE_POOL_NAME)
REFERENCES TAPE_POOL(TAPE_POOL_NAME)
);
CREATE TABLE MOUNT_GROUP(
MOUNT_GROUP_NAME VARCHAR2(100) NOT NULL,
ARCHIVE_PRIORITY INTEGER NOT NULL,
MIN_ARCHIVE_FILES_QUEUED INTEGER NOT NULL,
MIN_ARCHIVE_BYTES_QUEUED INTEGER NOT NULL,
MIN_ARCHIVE_REQUEST_AGE INTEGER NOT NULL,
ARCHIVE_PRIORITY INTEGER NOT NULL,
ARCHIVE_MIN_REQUEST_AGE INTEGER NOT NULL,
RETRIEVE_PRIORITY INTEGER NOT NULL,
MIN_RETRIEVE_FILES_QUEUED INTEGER NOT NULL,
MIN_RETRIEVE_BYTES_QUEUED INTEGER NOT NULL,
MIN_RETRIEVE_REQUEST_AGE INTEGER NOT NULL,
RETRIEVE_PRIORITY INTEGER NOT NULL,
RETRIEVE_MIN_REQUEST_AGE INTEGER NOT NULL,
MAX_DRIVES_ALLOWED INTEGER NOT NULL,
......@@ -199,7 +197,7 @@ CREATE TABLE MOUNT_GROUP(
LAST_MOD_HOST_NAME VARCHAR2(100) NOT NULL,
LAST_MOD_TIME INTEGER NOT NULL,
PRIMARY KEY(MOUNT_GROUP_NAME)
CONSTRAINT MOUNT_GROUP_PK PRIMARY KEY(MOUNT_GROUP_NAME)
);
CREATE TABLE END_USER(
......@@ -220,14 +218,14 @@ CREATE TABLE END_USER(
LAST_MOD_HOST_NAME VARCHAR2(100) NOT NULL,
LAST_MOD_TIME INTEGER NOT NULL,
PRIMARY KEY(USER_NAME),
FOREIGN KEY(MOUNT_GROUP_NAME) REFERENCES
MOUNT_GROUP(MOUNT_GROUP_NAME)
CONSTRAINT END_USER_PK PRIMARY KEY(USER_NAME),
CONSTRAINT END_USER_MOUNT_GROUP_FK FOREIGN KEY(MOUNT_GROUP_NAME)
REFERENCES MOUNT_GROUP(MOUNT_GROUP_NAME)
);
CREATE TABLE ARCHIVE_FILE(
ARCHIVE_FILE_ID INTEGER NOT NULL,
ARCHIVE_FILE_ID INTEGER NOT NULL,
DISK_INSTANCE VARCHAR2(100) NOT NULL,
DISK_FILE_ID VARCHAR2(100) NOT NULL,
FILE_SIZE INTEGER NOT NULL,
......@@ -241,10 +239,12 @@ CREATE TABLE ARCHIVE_FILE(
RECOVERY_GROUP VARCHAR2(100) NOT NULL,
RECOVERY_BLOB VARCHAR2(100) NOT NULL,
PRIMARY KEY(ARCHIVE_FILE_ID),
FOREIGN KEY(STORAGE_CLASS_NAME)
CONSTRAINT ARCHIVE_FILE_PK PRIMARY KEY(ARCHIVE_FILE_ID),
CONSTRAINT ARCHIVE_FILE_STORAGE_CLASS_FK FOREIGN KEY(STORAGE_CLASS_NAME)
REFERENCES STORAGE_CLASS(STORAGE_CLASS_NAME),
UNIQUE(DISK_INSTANCE, DISK_FILE_ID)
CONSTRAINT ARCHIVE_FILE_DSK_INST_FILE_UN UNIQUE(DISK_INSTANCE, DISK_FILE_ID)
);
CREATE TABLE TAPE_FILE(
......@@ -254,8 +254,10 @@ CREATE TABLE TAPE_FILE(
CREATION_TIME INTEGER NOT NULL,
ARCHIVE_FILE_ID INTEGER NOT NULL,
PRIMARY KEY(VID, FSEQ),
FOREIGN KEY(ARCHIVE_FILE_ID)
CONSTRAINT TAPE_FILE_PK PRIMARY KEY(VID, FSEQ),
CONSTRAINT TAPE_FILE_ARCHIVE_FILE_FK FOREIGN KEY(ARCHIVE_FILE_ID)
REFERENCES ARCHIVE_FILE(ARCHIVE_FILE_ID),
UNIQUE(FSEQ, BLOCK_ID)
CONSTRAINT TAPE_FILE_FSEQ_BLOCK_ID_UN UNIQUE(FSEQ, BLOCK_ID)
);
......@@ -24,19 +24,19 @@
// constructor
//------------------------------------------------------------------------------
cta::common::dataStructures::LogicalLibrary::LogicalLibrary():
archive_minBytesQueued(0),
retrieve_minBytesQueued(0) {}
archiveMinBytesQueued(0),
retrieveMinBytesQueued(0) {}
//------------------------------------------------------------------------------
// operator==
//------------------------------------------------------------------------------
bool cta::common::dataStructures::LogicalLibrary::operator==(const LogicalLibrary &rhs) const {
return archive_minBytesQueued==rhs.archive_minBytesQueued
return archiveMinBytesQueued==rhs.archiveMinBytesQueued
&& comment==rhs.comment
&& creationLog==rhs.creationLog
&& lastModificationLog==rhs.lastModificationLog
&& name==rhs.name
&& retrieve_minBytesQueued==rhs.retrieve_minBytesQueued;
&& retrieveMinBytesQueued==rhs.retrieveMinBytesQueued;
}
//------------------------------------------------------------------------------
......@@ -50,12 +50,12 @@ bool cta::common::dataStructures::LogicalLibrary::operator!=(const LogicalLibrar
// operator<<
//------------------------------------------------------------------------------
std::ostream &operator<<(std::ostream &os, const cta::common::dataStructures::LogicalLibrary &obj) {
os << "(archive_minBytesQueued=" << obj.archive_minBytesQueued
os << "(archiveMinBytesQueued=" << obj.archiveMinBytesQueued
<< " comment=" << obj.comment
<< " creationLog=" << obj.creationLog
<< " lastModificationLog=" << obj.lastModificationLog
<< " name=" << obj.name
<< " retrieve_minBytesQueued=" << obj.retrieve_minBytesQueued << ")";
<< " retrieveMinBytesQueued=" << obj.retrieveMinBytesQueued << ")";
return os;
}
......@@ -37,12 +37,12 @@ struct LogicalLibrary {
bool operator!=(const LogicalLibrary &rhs) const;
uint64_t archive_minBytesQueued;
uint64_t archiveMinBytesQueued;
std::string comment;
cta::common::dataStructures::EntryLog creationLog;
cta::common::dataStructures::EntryLog lastModificationLog;
std::string name;
uint64_t retrieve_minBytesQueued;
uint64_t retrieveMinBytesQueued;
}; // struct LogicalLibrary
......
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