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

WIP SQLite backend

parent dea2d33c
......@@ -13,9 +13,10 @@ cta::AdminHost::AdminHost():
cta::AdminHost::AdminHost(
const std::string &name,
const UserIdentity &creator,
const time_t creationTime,
const std::string &comment):
m_name(name),
m_creationTime(time(NULL)),
m_creationTime(creationTime),
m_creator(creator),
m_comment(comment) {
}
......
......@@ -27,6 +27,7 @@ public:
AdminHost(
const std::string &name,
const UserIdentity &creator,
const time_t creationTime,
const std::string &comment);
/**
......
......@@ -13,9 +13,10 @@ cta::AdminUser::AdminUser():
cta::AdminUser::AdminUser(
const UserIdentity &user,
const UserIdentity &creator,
const time_t creationTime,
const std::string &comment):
m_user(user),
m_creationTime(time(NULL)),
m_creationTime(creationTime),
m_creator(creator),
m_comment(comment) {
}
......
......@@ -27,6 +27,7 @@ public:
AdminUser(
const UserIdentity &user,
const UserIdentity &creator,
const time_t creationTime,
const std::string &comment);
/**
......
......@@ -15,11 +15,12 @@ cta::ArchivalJob::ArchivalJob(
const ArchivalJobState::Enum state,
const std::string &srcUrl,
const std::string &dstPath,
const UserIdentity &creator):
const UserIdentity &creator,
const time_t creationTime):
m_state(state),
m_srcUrl(srcUrl),
m_dstPath(dstPath),
m_creationTime(time(NULL)),
m_creationTime(creationTime),
m_creator(creator) {
}
......
......@@ -31,7 +31,8 @@ public:
const ArchivalJobState::Enum state,
const std::string &srcUrl,
const std::string &dstPath,
const UserIdentity &creator);
const UserIdentity &creator,
const time_t creationTime);
/**
* Sets the state of the archival job.
......
......@@ -38,6 +38,7 @@ set (MIDDLE_TIER_LIB_SRC_FILES
SecurityIdentity.cpp
SqliteDatabase.cpp
SqliteMiddleTierAdmin.cpp
SqliteMiddleTierUser.cpp
StorageClass.cpp
Tape.cpp
TapePool.cpp
......@@ -58,6 +59,8 @@ set (MIDDLE_TIER_UNIT_TESTS_LIB_SRC_FILES
MockMiddleTierUserTest.cpp
MockTapeTableTest.cpp
MockTapePoolTableTest.cpp
SqliteMiddleTierAdminTest.cpp
SqliteMiddleTierUserTest.cpp
UtilsTest.cpp)
add_library (ctamiddletierunittests SHARED
......
......@@ -13,7 +13,7 @@ void cta::FileSystemStorageClasses::createStorageClass(
const std::string &comment) {
try {
checkStorageClassDoesNotAlreadyExist(name);
StorageClass storageClass(name, nbCopies, creator, comment);
StorageClass storageClass(name, nbCopies, creator, time(NULL), comment);
m_storageClasses[name] = storageClass;
} catch(std::exception &ex) {
throw Exception(std::string("Failed to create storage class: ") +
......
......@@ -13,9 +13,10 @@ cta::LogicalLibrary::LogicalLibrary():
cta::LogicalLibrary::LogicalLibrary(
const std::string &name,
const UserIdentity &creator,
const time_t creationTime,
const std::string &comment):
m_name(name),
m_creationTime(time(NULL)),
m_creationTime(creationTime),
m_creator(creator),
m_comment(comment) {
}
......
......@@ -27,6 +27,7 @@ public:
LogicalLibrary(
const std::string &name,
const UserIdentity &creator,
const time_t creationTime,
const std::string &comment);
/**
......
......@@ -16,11 +16,12 @@ cta::MigrationRoute::MigrationRoute(
const uint8_t copyNb,
const std::string &tapePoolName,
const UserIdentity &creator,
const time_t creationTime,
const std::string &comment):
m_storageClassName(storageClassName),
m_copyNb(copyNb),
m_tapePoolName(tapePoolName),
m_creationTime(time(NULL)),
m_creationTime(creationTime),
m_creator(creator),
m_comment(comment) {
}
......
......@@ -34,6 +34,7 @@ public:
const uint8_t copyNb,
const std::string &tapePoolName,
const UserIdentity &creator,
const time_t creationTime,
const std::string &comment);
/**
......
......@@ -11,7 +11,7 @@ void cta::MockAdminHostTable::createAdminHost(
const std::string &hostName,
const std::string &comment) {
checkAdminHostDoesNotAlreadyExist(hostName);
AdminHost adminHost(hostName, requester.user, comment);
AdminHost adminHost(hostName, requester.user, time(NULL), comment);
m_adminHosts[hostName] = adminHost;
}
......
......@@ -13,7 +13,7 @@ void cta::MockAdminUserTable::createAdminUser(
const UserIdentity &user,
const std::string &comment) {
checkAdminUserDoesNotAlreadyExist(user);
AdminUser adminUser(user, requester.user, comment);
AdminUser adminUser(user, requester.user, time(NULL), comment);
m_adminUsers[user.getUid()] = adminUser;
}
......
......@@ -13,7 +13,7 @@ void cta::MockArchivalJobTable::createArchivalJob(
const std::string &dstPath) {
checkArchivalJobDoesNotAlreadyExist(dstPath);
ArchivalJob job(ArchivalJobState::NONE, srcUrl, dstPath, requester.user);
ArchivalJob job(ArchivalJobState::NONE, srcUrl, dstPath, requester.user, time(NULL));
std::map<std::string, std::map<time_t, ArchivalJob> >::iterator poolItor =
m_jobsTree.find(tapePoolName);
......
......@@ -13,7 +13,7 @@ void cta::MockLogicalLibraryTable::createLogicalLibrary(
const std::string &name,
const std::string &comment) {
checkLogicalLibraryDoesNotAlreadyExist(name);
LogicalLibrary logicalLibrary(name, requester.user, comment);
LogicalLibrary logicalLibrary(name, requester.user, time(NULL), comment);
m_libraries[name] = logicalLibrary;
}
......
......@@ -18,7 +18,8 @@ void cta::MockMigrationRouteTable::createMigrationRoute(
storageClassName,
copyNb,
tapePoolName,
creator,
creator,
time(NULL),
comment);
m_migrationRoutes[routeId] = route;
}
......
......@@ -13,7 +13,7 @@ void cta::MockTapePoolTable::createTapePool(
const uint32_t nbPartialTapes,
const std::string &comment) {
checkTapePoolDoesNotAlreadyExist(name);
TapePool tapePool(name, nbDrives, nbPartialTapes,requester.user, comment);
TapePool tapePool(name, nbDrives, nbPartialTapes,requester.user, time(NULL), comment);
m_tapePools[name] = tapePool;
}
......
......@@ -19,7 +19,9 @@ void cta::MockTapeTable::createTape(
logicalLibraryName,
tapePoolName,
capacityInBytes,
0,
requester.user,
time(NULL),
comment);
m_tapes[vid] = tape;
}
......
......@@ -15,10 +15,11 @@ cta::RetrievalJob::RetrievalJob(
const RetrievalJobState::Enum state,
const std::string &srcPath,
const std::string &dstUrl,
const UserIdentity &creator):
const UserIdentity &creator,
const time_t creationTime):
m_srcPath(srcPath),
m_dstUrl(dstUrl),
m_creationTime(time(NULL)),
m_creationTime(creationTime),
m_creator(creator) {
}
......
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