diff --git a/catalogue/SqliteCatalogue.cpp b/catalogue/SqliteCatalogue.cpp index fecd90d3cbf7eec69fb6304f98a2501b4144b18a..7b80926f576d2dd105f9ee2fa080772fa0c90131 100644 --- a/catalogue/SqliteCatalogue.cpp +++ b/catalogue/SqliteCatalogue.cpp @@ -1985,6 +1985,7 @@ void SqliteCatalogue::createTapeFile(const common::dataStructures::TapeFile &tap "VID," "FSEQ," "BLOCK_ID," + "COMPRESSED_SIZE," "COPY_NB," "CREATION_TIME," "ARCHIVE_FILE_ID)" @@ -1992,6 +1993,7 @@ void SqliteCatalogue::createTapeFile(const common::dataStructures::TapeFile &tap ":VID," ":FSEQ," ":BLOCK_ID," + ":COMPRESSED_SIZE," ":COPY_NB," ":CREATION_TIME," ":ARCHIVE_FILE_ID);"; @@ -2000,6 +2002,7 @@ void SqliteCatalogue::createTapeFile(const common::dataStructures::TapeFile &tap stmt->bind(":VID", tapeFile.vid); stmt->bind(":FSEQ", tapeFile.fSeq); stmt->bind(":BLOCK_ID", tapeFile.blockId); + stmt->bind(":COMPRESSED_SIZE", tapeFile.compressedSize); stmt->bind(":COPY_NB", tapeFile.copyNb); stmt->bind(":CREATION_TIME", now); stmt->bind(":ARCHIVE_FILE_ID", archiveFileId); @@ -2014,11 +2017,12 @@ std::list<common::dataStructures::TapeFile> SqliteCatalogue::getTapeFiles() cons std::list<cta::common::dataStructures::TapeFile> files; const char *const sql = "SELECT " - "VID AS VID," - "FSEQ AS FSEQ," - "BLOCK_ID AS BLOCK_ID," - "COPY_NB AS COPY_NB," - "CREATION_TIME AS CREATION_TIME " + "VID AS VID," + "FSEQ AS FSEQ," + "BLOCK_ID AS BLOCK_ID," + "COMPRESSED_SIZE AS COMPRESSED_SIZE," + "COPY_NB AS COPY_NB," + "CREATION_TIME AS CREATION_TIME " "FROM TAPE_FILE;"; std::unique_ptr<SqliteStmt> stmt(m_conn.createStmt(sql)); ColumnNameToIdx nameToIdx; @@ -2031,6 +2035,7 @@ std::list<common::dataStructures::TapeFile> SqliteCatalogue::getTapeFiles() cons file.vid = stmt->columnText(nameToIdx["VID"]); file.fSeq = stmt->columnUint64(nameToIdx["FSEQ"]); file.blockId = stmt->columnUint64(nameToIdx["BLOCK_ID"]); + file.compressedSize = stmt->columnUint64(nameToIdx["COMPRESSED_SIZE"]); file.copyNb = stmt->columnUint64(nameToIdx["COPY_NB"]); file.creationTime = stmt->columnUint64(nameToIdx["CREATION_TIME"]); diff --git a/catalogue/SqliteCatalogueTest.cpp b/catalogue/SqliteCatalogueTest.cpp index d1c5033173c2e2a18de6a4b1f31083739ee08835..2388554a3e34bc3bcce9fe717f85b4632dbbf1a6 100644 --- a/catalogue/SqliteCatalogueTest.cpp +++ b/catalogue/SqliteCatalogueTest.cpp @@ -1062,9 +1062,10 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, createTapeFile) { common::dataStructures::TapeFile tapeFile; tapeFile.vid = "VID"; - tapeFile.copyNb = 1; tapeFile.fSeq = 5678; tapeFile.blockId = 9012; + tapeFile.compressedSize = 5; + tapeFile.copyNb = 1; const uint64_t archiveFileId = 1234; @@ -1074,9 +1075,10 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, createTapeFile) { ASSERT_EQ(1, tapeFiles.size()); ASSERT_EQ(tapeFile.vid, tapeFiles.front().vid); - ASSERT_EQ(tapeFile.copyNb, tapeFiles.front().copyNb); ASSERT_EQ(tapeFile.fSeq, tapeFiles.front().fSeq); ASSERT_EQ(tapeFile.blockId, tapeFiles.front().blockId); + ASSERT_EQ(tapeFile.compressedSize, tapeFiles.front().compressedSize); + ASSERT_EQ(tapeFile.copyNb, tapeFiles.front().copyNb); } TEST_F(cta_catalogue_SqliteCatalogueTest, getTapeLastFseq_no_such_tape) { diff --git a/catalogue/catalogue_schema.pdf b/catalogue/catalogue_schema.pdf index f1d43200dc4f4e76ec67af8c171c30ba148e4ef3..3daff7e61e8f7e5a5b0b167f61939c95efa0cabe 100644 Binary files a/catalogue/catalogue_schema.pdf and b/catalogue/catalogue_schema.pdf differ diff --git a/catalogue/catalogue_schema.sql b/catalogue/catalogue_schema.sql index 4fb4cc6be26642761daa156194b09105a20057bb..f05cd1bdc900ad539d7b615fd04cfbb48a2218c2 100644 --- a/catalogue/catalogue_schema.sql +++ b/catalogue/catalogue_schema.sql @@ -190,6 +190,7 @@ CREATE TABLE TAPE_FILE( VID VARCHAR2(100) NOT NULL, FSEQ INTEGER NOT NULL, BLOCK_ID INTEGER NOT NULL, + COMPRESSED_SIZE INTEGER NOT NULL, COPY_NB INTEGER NOT NULL, CREATION_TIME INTEGER NOT NULL, ARCHIVE_FILE_ID INTEGER NOT NULL, diff --git a/common/dataStructures/TapeFile.cpp b/common/dataStructures/TapeFile.cpp index 435a1122f99f8df4118288b145733b02e466d5da..15b3eab4adeb2b6dc341db92af26e459ec7c3f2b 100644 --- a/common/dataStructures/TapeFile.cpp +++ b/common/dataStructures/TapeFile.cpp @@ -26,6 +26,8 @@ cta::common::dataStructures::TapeFile::TapeFile(): fSeq(0), blockId(0), + compressedSize(0), + copyNb(0), creationTime(0) {} //------------------------------------------------------------------------------ diff --git a/common/dataStructures/TapeFile.hpp b/common/dataStructures/TapeFile.hpp index 6ea137c6723d21f8c8ffc478f251f3b57b9c21c3..94e6b523b3f8ba03a16ca93ca6bbba6d8857dc56 100644 --- a/common/dataStructures/TapeFile.hpp +++ b/common/dataStructures/TapeFile.hpp @@ -40,15 +40,10 @@ struct TapeFile { bool operator!=(const TapeFile &rhs) const; /** - * The volume indentifier of the tape on which the file has been written. + * The volume identifier of the tape on which the file has been written. */ std::string vid; - /** - * The copy number of the file. Copy numbers start from 1. - */ - uint64_t copyNb; - /** * The position of the file on tape in the form of its file sequence number. */ @@ -59,6 +54,21 @@ struct TapeFile { */ uint64_t blockId; + /** + * The compressed size of the tape file in bytes. In other words the actual + * number of bytes it occupies on tape. + */ + uint64_t compressedSize; + + /** + * The copy number of the file. + * + * Copy numbers start from 1. + * + * Copy number 0 is an invalid copy number. + */ + uint64_t copyNb; + /** * The time the file recorded in the catalogue. */