Commit 2297e6f8 authored by Cedric Caffy's avatar Cedric Caffy
Browse files

[catalogue] Added the tape lifecycle columns in the database + the method to...

[catalogue] Added the tape lifecycle columns in the database + the method to modify the state of the tape
parent 6cb7fb73
......@@ -200,6 +200,10 @@ CREATE TABLE TAPE(
READ_MOUNT_COUNT BIGINT UNSIGNED DEFAULT 0 CONSTRAINT TAPE_RMC_NN NOT NULL,
WRITE_MOUNT_COUNT BIGINT UNSIGNED DEFAULT 0 CONSTRAINT TAPE_WMC_NN NOT NULL,
USER_COMMENT VARCHAR(1000),
TAPE_STATE VARCHAR(100),
STATE_REASON VARCHAR(1000),
STATE_UPDATE_TIME BIGINT UNSIGNED,
STATE_MODIFIED_BY VARCHAR(100),
CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT TAPE_CLUN_NN NOT NULL,
CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT TAPE_CLHN_NN NOT NULL,
CREATION_LOG_TIME BIGINT UNSIGNED CONSTRAINT TAPE_CLT_NN NOT NULL,
......@@ -216,6 +220,7 @@ CREATE TABLE TAPE(
CONSTRAINT TAPE_IS_ARCHVIED_BOOL_CK CHECK(IS_ARCHIVED IN ('0', '1')),
CONSTRAINT TAPE_IS_EXPORTED_BOOL_CK CHECK(IS_EXPORTED IN ('0', '1')),
CONSTRAINT TAPE_DIRTY_BOOL_CK CHECK(DIRTY IN ('0','1')),
CONSTRAINT TAPE_STATE_CK CHECK(TAPE_STATE IN ('ACTIVE', 'DISABLED', 'BROKEN')),
CONSTRAINT TAPE_MEDIA_TYPE_FK FOREIGN KEY(MEDIA_TYPE_ID) REFERENCES MEDIA_TYPE(MEDIA_TYPE_ID)
);
CREATE INDEX TAPE_TAPE_POOL_ID_IDX ON TAPE(TAPE_POOL_ID);
......
......@@ -232,6 +232,10 @@ CREATE TABLE TAPE(
READ_MOUNT_COUNT NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_RMC_NN NOT NULL,
WRITE_MOUNT_COUNT NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_WMC_NN NOT NULL,
USER_COMMENT VARCHAR2(1000),
TAPE_STATE VARCHAR2(100),
STATE_REASON VARCHAR2(1000),
STATE_UPDATE_TIME NUMERIC(20, 0),
STATE_MODIFIED_BY VARCHAR2(100),
CREATION_LOG_USER_NAME VARCHAR2(100) CONSTRAINT TAPE_CLUN_NN NOT NULL,
CREATION_LOG_HOST_NAME VARCHAR2(100) CONSTRAINT TAPE_CLHN_NN NOT NULL,
CREATION_LOG_TIME NUMERIC(20, 0) CONSTRAINT TAPE_CLT_NN NOT NULL,
......@@ -248,6 +252,7 @@ CREATE TABLE TAPE(
CONSTRAINT TAPE_IS_ARCHVIED_BOOL_CK CHECK(IS_ARCHIVED IN ('0', '1')),
CONSTRAINT TAPE_IS_EXPORTED_BOOL_CK CHECK(IS_EXPORTED IN ('0', '1')),
CONSTRAINT TAPE_DIRTY_BOOL_CK CHECK(DIRTY IN ('0','1')),
CONSTRAINT TAPE_STATE_CK CHECK(TAPE_STATE IN ('ACTIVE', 'DISABLED', 'BROKEN')),
CONSTRAINT TAPE_MEDIA_TYPE_FK FOREIGN KEY(MEDIA_TYPE_ID) REFERENCES MEDIA_TYPE(MEDIA_TYPE_ID)
);
CREATE INDEX TAPE_TAPE_POOL_ID_IDX ON TAPE(TAPE_POOL_ID);
......
......@@ -214,6 +214,10 @@ CREATE TABLE TAPE(
READ_MOUNT_COUNT NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_RMC_NN NOT NULL,
WRITE_MOUNT_COUNT NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_WMC_NN NOT NULL,
USER_COMMENT VARCHAR(1000),
TAPE_STATE VARCHAR(100),
STATE_REASON VARCHAR(1000),
STATE_UPDATE_TIME NUMERIC(20, 0),
STATE_MODIFIED_BY VARCHAR(100),
CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT TAPE_CLUN_NN NOT NULL,
CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT TAPE_CLHN_NN NOT NULL,
CREATION_LOG_TIME NUMERIC(20, 0) CONSTRAINT TAPE_CLT_NN NOT NULL,
......@@ -230,6 +234,7 @@ CREATE TABLE TAPE(
CONSTRAINT TAPE_IS_ARCHVIED_BOOL_CK CHECK(IS_ARCHIVED IN ('0', '1')),
CONSTRAINT TAPE_IS_EXPORTED_BOOL_CK CHECK(IS_EXPORTED IN ('0', '1')),
CONSTRAINT TAPE_DIRTY_BOOL_CK CHECK(DIRTY IN ('0','1')),
CONSTRAINT TAPE_STATE_CK CHECK(TAPE_STATE IN ('ACTIVE', 'DISABLED', 'BROKEN')),
CONSTRAINT TAPE_MEDIA_TYPE_FK FOREIGN KEY(MEDIA_TYPE_ID) REFERENCES MEDIA_TYPE(MEDIA_TYPE_ID)
);
CREATE INDEX TAPE_TAPE_POOL_ID_IDX ON TAPE(TAPE_POOL_ID);
......
......@@ -186,6 +186,10 @@ CREATE TABLE TAPE(
READ_MOUNT_COUNT INTEGER DEFAULT 0 CONSTRAINT TAPE_RMC_NN NOT NULL,
WRITE_MOUNT_COUNT INTEGER DEFAULT 0 CONSTRAINT TAPE_WMC_NN NOT NULL,
USER_COMMENT VARCHAR(1000),
TAPE_STATE VARCHAR(100),
STATE_REASON VARCHAR(1000),
STATE_UPDATE_TIME INTEGER,
STATE_MODIFIED_BY VARCHAR(100),
CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT TAPE_CLUN_NN NOT NULL,
CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT TAPE_CLHN_NN NOT NULL,
CREATION_LOG_TIME INTEGER CONSTRAINT TAPE_CLT_NN NOT NULL,
......@@ -202,6 +206,7 @@ CREATE TABLE TAPE(
CONSTRAINT TAPE_IS_ARCHVIED_BOOL_CK CHECK(IS_ARCHIVED IN ('0', '1')),
CONSTRAINT TAPE_IS_EXPORTED_BOOL_CK CHECK(IS_EXPORTED IN ('0', '1')),
CONSTRAINT TAPE_DIRTY_BOOL_CK CHECK(DIRTY IN ('0','1')),
CONSTRAINT TAPE_STATE_CK CHECK(TAPE_STATE IN ('ACTIVE', 'DISABLED', 'BROKEN')),
CONSTRAINT TAPE_MEDIA_TYPE_FK FOREIGN KEY(MEDIA_TYPE_ID) REFERENCES MEDIA_TYPE(MEDIA_TYPE_ID)
);
CREATE INDEX TAPE_TAPE_POOL_ID_IDX ON TAPE(TAPE_POOL_ID);
......
......@@ -7190,6 +7190,10 @@ namespace catalogue{
" READ_MOUNT_COUNT NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_RMC_NN NOT NULL,"
" WRITE_MOUNT_COUNT NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_WMC_NN NOT NULL,"
" USER_COMMENT VARCHAR2(1000),"
" TAPE_STATE VARCHAR2(100),"
" STATE_REASON VARCHAR2(1000),"
" STATE_UPDATE_TIME NUMERIC(20, 0),"
" STATE_MODIFIED_BY VARCHAR2(100),"
" CREATION_LOG_USER_NAME VARCHAR2(100) CONSTRAINT TAPE_CLUN_NN NOT NULL,"
" CREATION_LOG_HOST_NAME VARCHAR2(100) CONSTRAINT TAPE_CLHN_NN NOT NULL,"
" CREATION_LOG_TIME NUMERIC(20, 0) CONSTRAINT TAPE_CLT_NN NOT NULL,"
......@@ -7206,6 +7210,7 @@ namespace catalogue{
" CONSTRAINT TAPE_IS_ARCHVIED_BOOL_CK CHECK(IS_ARCHIVED IN ('0', '1')),"
" CONSTRAINT TAPE_IS_EXPORTED_BOOL_CK CHECK(IS_EXPORTED IN ('0', '1')),"
" CONSTRAINT TAPE_DIRTY_BOOL_CK CHECK(DIRTY IN ('0','1')),"
" CONSTRAINT TAPE_STATE_CK CHECK(TAPE_STATE IN ('ACTIVE', 'DISABLED', 'BROKEN')),"
" CONSTRAINT TAPE_MEDIA_TYPE_FK FOREIGN KEY(MEDIA_TYPE_ID) REFERENCES MEDIA_TYPE(MEDIA_TYPE_ID)"
");"
"CREATE INDEX TAPE_TAPE_POOL_ID_IDX ON TAPE(TAPE_POOL_ID);"
......@@ -7610,6 +7615,10 @@ namespace catalogue{
" READ_MOUNT_COUNT BIGINT UNSIGNED DEFAULT 0 CONSTRAINT TAPE_RMC_NN NOT NULL,"
" WRITE_MOUNT_COUNT BIGINT UNSIGNED DEFAULT 0 CONSTRAINT TAPE_WMC_NN NOT NULL,"
" USER_COMMENT VARCHAR(1000),"
" TAPE_STATE VARCHAR(100),"
" STATE_REASON VARCHAR(1000),"
" STATE_UPDATE_TIME BIGINT UNSIGNED,"
" STATE_MODIFIED_BY VARCHAR(100),"
" CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT TAPE_CLUN_NN NOT NULL,"
" CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT TAPE_CLHN_NN NOT NULL,"
" CREATION_LOG_TIME BIGINT UNSIGNED CONSTRAINT TAPE_CLT_NN NOT NULL,"
......@@ -7626,6 +7635,7 @@ namespace catalogue{
" CONSTRAINT TAPE_IS_ARCHVIED_BOOL_CK CHECK(IS_ARCHIVED IN ('0', '1')),"
" CONSTRAINT TAPE_IS_EXPORTED_BOOL_CK CHECK(IS_EXPORTED IN ('0', '1')),"
" CONSTRAINT TAPE_DIRTY_BOOL_CK CHECK(DIRTY IN ('0','1')),"
" CONSTRAINT TAPE_STATE_CK CHECK(TAPE_STATE IN ('ACTIVE', 'DISABLED', 'BROKEN')),"
" CONSTRAINT TAPE_MEDIA_TYPE_FK FOREIGN KEY(MEDIA_TYPE_ID) REFERENCES MEDIA_TYPE(MEDIA_TYPE_ID)"
");"
"CREATE INDEX TAPE_TAPE_POOL_ID_IDX ON TAPE(TAPE_POOL_ID);"
......@@ -8015,6 +8025,10 @@ namespace catalogue{
" READ_MOUNT_COUNT INTEGER DEFAULT 0 CONSTRAINT TAPE_RMC_NN NOT NULL,"
" WRITE_MOUNT_COUNT INTEGER DEFAULT 0 CONSTRAINT TAPE_WMC_NN NOT NULL,"
" USER_COMMENT VARCHAR(1000),"
" TAPE_STATE VARCHAR(100),"
" STATE_REASON VARCHAR(1000),"
" STATE_UPDATE_TIME INTEGER,"
" STATE_MODIFIED_BY VARCHAR(100),"
" CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT TAPE_CLUN_NN NOT NULL,"
" CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT TAPE_CLHN_NN NOT NULL,"
" CREATION_LOG_TIME INTEGER CONSTRAINT TAPE_CLT_NN NOT NULL,"
......@@ -8031,6 +8045,7 @@ namespace catalogue{
" CONSTRAINT TAPE_IS_ARCHVIED_BOOL_CK CHECK(IS_ARCHIVED IN ('0', '1')),"
" CONSTRAINT TAPE_IS_EXPORTED_BOOL_CK CHECK(IS_EXPORTED IN ('0', '1')),"
" CONSTRAINT TAPE_DIRTY_BOOL_CK CHECK(DIRTY IN ('0','1')),"
" CONSTRAINT TAPE_STATE_CK CHECK(TAPE_STATE IN ('ACTIVE', 'DISABLED', 'BROKEN')),"
" CONSTRAINT TAPE_MEDIA_TYPE_FK FOREIGN KEY(MEDIA_TYPE_ID) REFERENCES MEDIA_TYPE(MEDIA_TYPE_ID)"
");"
"CREATE INDEX TAPE_TAPE_POOL_ID_IDX ON TAPE(TAPE_POOL_ID);"
......@@ -8446,6 +8461,10 @@ namespace catalogue{
" READ_MOUNT_COUNT NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_RMC_NN NOT NULL,"
" WRITE_MOUNT_COUNT NUMERIC(20, 0) DEFAULT 0 CONSTRAINT TAPE_WMC_NN NOT NULL,"
" USER_COMMENT VARCHAR(1000),"
" TAPE_STATE VARCHAR(100),"
" STATE_REASON VARCHAR(1000),"
" STATE_UPDATE_TIME NUMERIC(20, 0),"
" STATE_MODIFIED_BY VARCHAR(100),"
" CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT TAPE_CLUN_NN NOT NULL,"
" CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT TAPE_CLHN_NN NOT NULL,"
" CREATION_LOG_TIME NUMERIC(20, 0) CONSTRAINT TAPE_CLT_NN NOT NULL,"
......@@ -8462,6 +8481,7 @@ namespace catalogue{
" CONSTRAINT TAPE_IS_ARCHVIED_BOOL_CK CHECK(IS_ARCHIVED IN ('0', '1')),"
" CONSTRAINT TAPE_IS_EXPORTED_BOOL_CK CHECK(IS_EXPORTED IN ('0', '1')),"
" CONSTRAINT TAPE_DIRTY_BOOL_CK CHECK(DIRTY IN ('0','1')),"
" CONSTRAINT TAPE_STATE_CK CHECK(TAPE_STATE IN ('ACTIVE', 'DISABLED', 'BROKEN')),"
" CONSTRAINT TAPE_MEDIA_TYPE_FK FOREIGN KEY(MEDIA_TYPE_ID) REFERENCES MEDIA_TYPE(MEDIA_TYPE_ID)"
");"
"CREATE INDEX TAPE_TAPE_POOL_ID_IDX ON TAPE(TAPE_POOL_ID);"
......
......@@ -608,7 +608,7 @@ public:
virtual void modifyTapeLogicalLibraryName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &logicalLibraryName) = 0;
virtual void modifyTapeTapePoolName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &tapePoolName) = 0;
virtual void modifyTapeEncryptionKeyName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &encryptionKeyName) = 0;
virtual void modifyTapeState(const std::string &vid, const common::dataStructures::Tape::State & state, const cta::optional<std::string> & stateReason, const std::string & stateModifiedBy) = 0;
/**
* Sets the full status of the specified tape.
*
......
......@@ -355,6 +355,10 @@ public:
void modifyTapeEncryptionKeyName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &encryptionKeyName) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeEncryptionKeyName(admin, vid, encryptionKeyName);}, m_maxTriesToConnect);
}
void modifyTapeState(const std::string &vid, const common::dataStructures::Tape::State & state, const cta::optional<std::string> & stateReason, const std::string & stateModifiedBy) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeState(vid, state, stateReason, stateModifiedBy);}, m_maxTriesToConnect);
}
void setTapeFull(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const bool fullValue) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->setTapeFull(admin, vid, fullValue);}, m_maxTriesToConnect);
......
......@@ -129,6 +129,7 @@ public:
void modifyStorageClassNbCopies(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t nbCopies) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyTapeComment(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const cta::optional<std::string> &comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyTapeEncryptionKeyName(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& encryptionKeyName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyTapeState(const std::string &vid, const common::dataStructures::Tape::State & state, const cta::optional<std::string> & stateReason, const std::string & stateModifiedBy) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyTapeMediaType(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& mediaType) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyTapeVendor(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& vendor) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyTapeLogicalLibraryName(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& logicalLibraryName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
......
......@@ -4420,6 +4420,58 @@ void RdbmsCatalogue::modifyTapeEncryptionKeyName(const common::dataStructures::S
}
}
//------------------------------------------------------------------------------
// modifyTapeState
//------------------------------------------------------------------------------
void RdbmsCatalogue::modifyTapeState(const std::string &vid, const common::dataStructures::Tape::State & state, const cta::optional<std::string> & stateReason, const std::string & stateModifiedBy){
try {
using namespace common::dataStructures;
const time_t now = time(nullptr);
std::string stateStr;
try {
stateStr = Tape::STATE_TO_STRING_MAP.at(state);
} catch(std::out_of_range & ex){
std::string errorMsg = "The state provided in parameter (" + std::to_string(state) + ") is not known or has not been initialized";
throw cta::exception::Exception(errorMsg);
}
//Check the reason is set for all the status except the ACTIVE one, this is the only status that allows the reason to be set to null.
if(state != Tape::State::ACTIVE){
if(!stateReason){
throw exception::UserError(std::string("Cannot modify the state of the tape ") + vid + " to " + stateStr + " because the reason has not been provided.");
}
}
const char *const sql =
"UPDATE TAPE SET "
"TAPE_STATE = :TAPE_STATE,"
"STATE_REASON = :STATE_REASON,"
"STATE_UPDATE_TIME = :STATE_UPDATE_TIME,"
"STATE_MODIFIED_BY = :STATE_MODIFIED_BY "
"WHERE "
"VID = :VID";
auto conn = m_connPool.getConn();
auto stmt = conn.createStmt(sql);
stmt.bindString(":TAPE_STATE", stateStr);
stmt.bindString(":STATE_REASON", stateReason);
stmt.bindUint64(":STATE_UPDATE_TIME", now);
stmt.bindString(":STATE_MODIFIED_BY",stateModifiedBy);
stmt.executeNonQuery();
if (0 == stmt.getNbAffectedRows()) {
throw exception::UserError(std::string("Cannot modify the state of the tape ") + vid + " because it does not exist");
}
} catch(exception::UserError &) {
throw;
} catch(exception::Exception &ex) {
ex.getMessage().str(std::string(__FUNCTION__) + ": " + ex.getMessage().str());
throw;
}
}
//------------------------------------------------------------------------------
// tapeMountedForArchive
//------------------------------------------------------------------------------
......
......@@ -578,7 +578,8 @@ public:
void modifyTapeLogicalLibraryName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &logicalLibraryName) override;
void modifyTapeTapePoolName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &tapePoolName) override;
void modifyTapeEncryptionKeyName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &encryptionKeyName) override;
void modifyTapeState(const std::string &vid, const common::dataStructures::Tape::State & state, const cta::optional<std::string> & stateReason, const std::string & stateModifiedBy) override;
/**
* Sets the full status of the specified tape.
*
......
......@@ -165,6 +165,10 @@ CREATE TABLE TAPE(
READ_MOUNT_COUNT UINT64TYPE DEFAULT 0 CONSTRAINT TAPE_RMC_NN NOT NULL,
WRITE_MOUNT_COUNT UINT64TYPE DEFAULT 0 CONSTRAINT TAPE_WMC_NN NOT NULL,
USER_COMMENT VARCHAR(1000),
TAPE_STATE VARCHAR(100),
STATE_REASON VARCHAR(1000),
STATE_UPDATE_TIME UINT64TYPE,
STATE_MODIFIED_BY VARCHAR(100),
CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT TAPE_CLUN_NN NOT NULL,
CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT TAPE_CLHN_NN NOT NULL,
CREATION_LOG_TIME UINT64TYPE CONSTRAINT TAPE_CLT_NN NOT NULL,
......@@ -181,6 +185,7 @@ CREATE TABLE TAPE(
CONSTRAINT TAPE_IS_ARCHVIED_BOOL_CK CHECK(IS_ARCHIVED IN ('0', '1')),
CONSTRAINT TAPE_IS_EXPORTED_BOOL_CK CHECK(IS_EXPORTED IN ('0', '1')),
CONSTRAINT TAPE_DIRTY_BOOL_CK CHECK(DIRTY IN ('0','1')),
CONSTRAINT TAPE_STATE_CK CHECK(TAPE_STATE IN ('ACTIVE', 'DISABLED', 'BROKEN')),
CONSTRAINT TAPE_MEDIA_TYPE_FK FOREIGN KEY(MEDIA_TYPE_ID) REFERENCES MEDIA_TYPE(MEDIA_TYPE_ID)
);
CREATE INDEX TAPE_TAPE_POOL_ID_IDX ON TAPE(TAPE_POOL_ID);
......
......@@ -38,6 +38,18 @@ Tape::Tape():
readOnly(false)
{}
const std::map<Tape::State,std::string> Tape::STATE_TO_STRING_MAP = {
{Tape::State::ACTIVE,"ACTIVE"},
{Tape::State::BROKEN,"BROKEN"},
{Tape::State::DISABLED,"DISABLED"}
};
const std::map<std::string,Tape::State> Tape::STRING_TO_STATE_MAP = {
{"ACTIVE",Tape::State::ACTIVE},
{"BROKEN",Tape::State::BROKEN},
{"DISABLED",Tape::State::DISABLED}
};
//------------------------------------------------------------------------------
// operator==
//------------------------------------------------------------------------------
......@@ -88,7 +100,7 @@ std::ostream &operator<<(std::ostream &os, const Tape &obj) {
<< " lastWriteLog=" << obj.lastWriteLog
<< " lastReadLog=" << obj.lastReadLog << ")";
return os;
}
}
} // namespace dataStructures
} // namespace common
......
......@@ -36,6 +36,15 @@ namespace dataStructures {
*/
struct Tape {
enum State {
ACTIVE,
BROKEN,
DISABLED
};
static const std::map<State,std::string> STATE_TO_STRING_MAP;
static const std::map<std::string,State> STRING_TO_STATE_MAP;
Tape();
bool operator==(const Tape &rhs) const;
......@@ -76,6 +85,11 @@ struct Tape {
optional<TapeLog> lastWriteLog;
optional<TapeLog> lastReadLog;
State state;
optional<std::string> stateReason;
std::string stateModifiedBy;
time_t stateModifiedTime;
}; // struct Tape
std::ostream &operator<<(std::ostream &os, const Tape &obj);
......
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