Commit 7724a676 authored by Eric Cano's avatar Eric Cano
Browse files

Started morphing the code to accomodate both the move some data structure from...

Started morphing the code to accomodate both the move some data structure from OStoreDB to catalogue and shared structures modifications.
Renamed class members using underscode instead of mixed case.
Removed mount criteria from in-memory tape pool representation.
Removed support for path of archive files for in-memory representations.
Removed all but maxDrives allowed from in-memory representation of mount
policy.
Created new constructor for UserIdentity.
Switch the UserIdentity used by RemoteFileStatus.
Renamed TapePoolQueue to ArchiveQueue.
Replaced CreationLog usages with EntryLog.
Renamed TapeQueue to RetrieveQueue.
Removed support for data now gone to catalogue from RootEntry.
Removed corresponding structures from object store.
Removed corresponding calls from SchedulerDatabase and inheriting
classes (OStoreDB).
parent 71ab4f06
......@@ -1510,13 +1510,13 @@ std::list<common::dataStructures::MountPolicy>
policy.name = rset->columnText("MOUNT_POLICY_NAME");
policy.archive_priority = rset->columnUint64("ARCHIVE_PRIORITY");
policy.archive_minRequestAge =
policy.archivePriority = rset->columnUint64("ARCHIVE_PRIORITY");
policy.archiveMinRequestAge =
rset->columnUint64("ARCHIVE_MIN_REQUEST_AGE");
policy.retrieve_priority =
policy.retrievePriority =
rset->columnUint64("RETRIEVE_PRIORITY");
policy.retrieve_minRequestAge =
policy.retrieveMinRequestAge =
rset->columnUint64("RETRIEVE_MIN_REQUEST_AGE");
policy.maxDrivesAllowed =
......@@ -2120,11 +2120,11 @@ common::dataStructures::MountPolicy SqliteCatalogue::
policy.name = rset->columnText("MOUNT_POLICY_NAME");
policy.archive_priority = rset->columnUint64("ARCHIVE_PRIORITY");
policy.archive_minRequestAge = rset->columnUint64("ARCHIVE_MIN_REQUEST_AGE");
policy.archivePriority = rset->columnUint64("ARCHIVE_PRIORITY");
policy.archiveMinRequestAge = rset->columnUint64("ARCHIVE_MIN_REQUEST_AGE");
policy.retrieve_priority = rset->columnUint64("RETRIEVE_PRIORITY");
policy.retrieve_minRequestAge = rset->columnUint64("RETRIEVE_MIN_REQUEST_AGE");
policy.retrievePriority = rset->columnUint64("RETRIEVE_PRIORITY");
policy.retrieveMinRequestAge = rset->columnUint64("RETRIEVE_MIN_REQUEST_AGE");
policy.maxDrivesAllowed =
rset->columnUint64("MAX_DRIVES_ALLOWED");
......
......@@ -712,11 +712,11 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, createMountPolicy) {
ASSERT_EQ(name, group.name);
ASSERT_EQ(archivePriority, group.archive_priority);
ASSERT_EQ(minArchiveRequestAge, group.archive_minRequestAge);
ASSERT_EQ(archivePriority, group.archivePriority);
ASSERT_EQ(minArchiveRequestAge, group.archiveMinRequestAge);
ASSERT_EQ(retrievePriority, group.retrieve_priority);
ASSERT_EQ(minRetrieveRequestAge, group.retrieve_minRequestAge);
ASSERT_EQ(retrievePriority, group.retrievePriority);
ASSERT_EQ(minRetrieveRequestAge, group.retrieveMinRequestAge);
ASSERT_EQ(maxDrivesAllowed, group.maxDrivesAllowed);
......@@ -816,11 +816,11 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, createUser) {
const common::dataStructures::MountPolicy policy =
catalogue.getMountPolicyForAUser(userIdentity);
ASSERT_EQ(archivePriority, policy.archive_priority);
ASSERT_EQ(minArchiveRequestAge, policy.archive_minRequestAge);
ASSERT_EQ(archivePriority, policy.archivePriority);
ASSERT_EQ(minArchiveRequestAge, policy.archiveMinRequestAge);
ASSERT_EQ(maxDrivesAllowed, policy.maxDrivesAllowed);
ASSERT_EQ(retrievePriority, policy.retrieve_priority);
ASSERT_EQ(minRetrieveRequestAge, policy.retrieve_minRequestAge);
ASSERT_EQ(retrievePriority, policy.retrievePriority);
ASSERT_EQ(minRetrieveRequestAge, policy.retrieveMinRequestAge);
}
TEST_F(cta_catalogue_SqliteCatalogueTest, createUser_same_twice) {
......@@ -978,11 +978,11 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, prepareForNewFile) {
const common::dataStructures::MountPolicy policy =
catalogue.getMountPolicyForAUser(userIdentity);
ASSERT_EQ(archivePriority, policy.archive_priority);
ASSERT_EQ(minArchiveRequestAge, policy.archive_minRequestAge);
ASSERT_EQ(archivePriority, policy.archivePriority);
ASSERT_EQ(minArchiveRequestAge, policy.archiveMinRequestAge);
ASSERT_EQ(maxDrivesAllowed, policy.maxDrivesAllowed);
ASSERT_EQ(retrievePriority, policy.retrieve_priority);
ASSERT_EQ(minRetrieveRequestAge, policy.retrieve_minRequestAge);
ASSERT_EQ(retrievePriority, policy.retrievePriority);
ASSERT_EQ(minRetrieveRequestAge, policy.retrieveMinRequestAge);
ASSERT_TRUE(catalogue.getArchiveRoutes().empty());
......@@ -1036,8 +1036,8 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, prepareForNewFile) {
ASSERT_EQ(1, queueCriteria.copyToPoolMap.size());
ASSERT_EQ(copyNb, queueCriteria.copyToPoolMap.begin()->first);
ASSERT_EQ(tapePoolName, queueCriteria.copyToPoolMap.begin()->second);
ASSERT_EQ(archivePriority, queueCriteria.mountPolicy.archive_priority);
ASSERT_EQ(minArchiveRequestAge, queueCriteria.mountPolicy.archive_minRequestAge);
ASSERT_EQ(archivePriority, queueCriteria.mountPolicy.archivePriority);
ASSERT_EQ(minArchiveRequestAge, queueCriteria.mountPolicy.archiveMinRequestAge);
ASSERT_EQ(maxDrivesAllowed, queueCriteria.mountPolicy.maxDrivesAllowed);
}
......
......@@ -37,11 +37,9 @@ cta::TapePool::~TapePool() throw() {
cta::TapePool::TapePool(
const std::string &name,
const uint32_t nbPartialTapes,
const MountCriteriaByDirection & mountCriteriaByDirection,
const CreationLog &creationLog):
name(name),
nbPartialTapes(nbPartialTapes),
mountCriteriaByDirection(mountCriteriaByDirection),
creationLog(creationLog) {}
//------------------------------------------------------------------------------
......
......@@ -52,7 +52,6 @@ struct TapePool {
TapePool(
const std::string &name,
const uint32_t nbPartialTapes,
const MountCriteriaByDirection & mountCriteriaByDirection,
const CreationLog &creationLog);
/**
......@@ -73,11 +72,6 @@ struct TapePool {
*/
uint32_t nbPartialTapes;
/**
* The collection of criteria for deciding (or not) to mount a tape.
*/
MountCriteriaByDirection mountCriteriaByDirection;
/**
* The record of the entry's creation
*/
......
......@@ -33,9 +33,8 @@ ArchiveFile::ArchiveFile():
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
ArchiveFile::ArchiveFile(const std::string & path, const std::string & nsHostName, uint64_t fileId,
ArchiveFile::ArchiveFile(const std::string & nsHostName, uint64_t fileId,
uint64_t size, const uint32_t checksum, const time_t lastModificationTime):
path(path),
nsHostName(nsHostName),
fileId(fileId),
size(size),
......
......@@ -43,21 +43,16 @@ public:
* @param checksum The file checksum
* @param lastModificationTime The last modification time of the file
*/
ArchiveFile(const std::string & path, const std::string & nsHostName, uint64_t fileId,
ArchiveFile(const std::string & nsHostName, uint64_t fileId,
uint64_t size, const uint32_t checksum, const time_t lastModificationTime);
/**
* The location of the file at NS lookup time
*/
std::string path;
/**
* The NS host name
*/
std::string nsHostName;
/**
* The file ID (to be used in the tape copy header)
* The file ID
*/
uint64_t fileId;
......
......@@ -28,10 +28,10 @@ namespace dataStructures {
// constructor
//------------------------------------------------------------------------------
MountPolicy::MountPolicy():
archive_priority(0),
archive_minRequestAge(0),
retrieve_priority(0),
retrieve_minRequestAge(0),
archivePriority(0),
archiveMinRequestAge(0),
retrievePriority(0),
retrieveMinRequestAge(0),
maxDrivesAllowed(0) {}
//------------------------------------------------------------------------------
......@@ -39,10 +39,10 @@ MountPolicy::MountPolicy():
//------------------------------------------------------------------------------
bool MountPolicy::operator==(const MountPolicy &rhs) const {
return name==rhs.name
&& archive_priority==rhs.archive_priority
&& archive_minRequestAge==rhs.archive_minRequestAge
&& retrieve_priority==rhs.retrieve_priority
&& retrieve_minRequestAge==rhs.retrieve_minRequestAge
&& archivePriority==rhs.archivePriority
&& archiveMinRequestAge==rhs.archiveMinRequestAge
&& retrievePriority==rhs.retrievePriority
&& retrieveMinRequestAge==rhs.retrieveMinRequestAge
&& maxDrivesAllowed==rhs.maxDrivesAllowed
&& creationLog==rhs.creationLog
&& lastModificationLog==rhs.lastModificationLog
......@@ -61,10 +61,10 @@ bool MountPolicy::operator!=(const MountPolicy &rhs) const {
//------------------------------------------------------------------------------
std::ostream &operator<<(std::ostream &os, const MountPolicy &obj) {
os << "(name=" << obj.name
<< " archive_priority=" << obj.archive_priority
<< " archive_minRequestAge=" << obj.archive_minRequestAge
<< " retrieve_priority=" << obj.retrieve_priority
<< " retrieve_minRequestAge=" << obj.retrieve_minRequestAge
<< " archive_priority=" << obj.archivePriority
<< " archive_minRequestAge=" << obj.archiveMinRequestAge
<< " retrieve_priority=" << obj.retrievePriority
<< " retrieve_minRequestAge=" << obj.retrieveMinRequestAge
<< " maxDrivesAllowed=" << obj.maxDrivesAllowed
<< " creationLog=" << obj.creationLog
<< " lastModificationLog=" << obj.lastModificationLog
......
......@@ -41,11 +41,13 @@ struct MountPolicy {
bool operator!=(const MountPolicy &rhs) const;
std::string name;
uint64_t archive_priority;
uint64_t archive_minRequestAge;
uint64_t retrieve_priority;
uint64_t retrieve_minRequestAge;
uint64_t archivePriority;
uint64_t archiveMinRequestAge;
uint64_t retrievePriority;
uint64_t retrieveMinRequestAge;
uint64_t maxDrivesAllowed;
uint64_t maxRetriesWithinMount;
uint64_t maxTotalRetries;
EntryLog creationLog;
EntryLog lastModificationLog;
std::string comment;
......
......@@ -27,7 +27,14 @@ namespace dataStructures {
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
UserIdentity::UserIdentity() {}
UserIdentity::UserIdentity() { }
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
UserIdentity::UserIdentity(const std::string& name, const std::string& group):
name(name), group(group) {}
//------------------------------------------------------------------------------
// operator==
......
......@@ -34,6 +34,8 @@ namespace dataStructures {
struct UserIdentity {
UserIdentity();
UserIdentity(const std::string &name, const std::string &group);
bool operator==(const UserIdentity &rhs) const;
......
......@@ -30,7 +30,7 @@ cta::RemoteFileStatus::RemoteFileStatus():
// constructor
//------------------------------------------------------------------------------
cta::RemoteFileStatus::RemoteFileStatus(
const UserIdentity &owner,
const common::dataStructures::UserIdentity &owner,
const mode_t mode,
const uint64_t size):
owner(owner),
......
......@@ -18,7 +18,7 @@
#pragma once
#include "common/UserIdentity.hpp"
#include "common/dataStructures/UserIdentity.hpp"
#include <stdint.h>
#include <string>
......@@ -44,14 +44,14 @@ struct RemoteFileStatus {
* @param size The size of the file in bytes.
*/
RemoteFileStatus(
const UserIdentity &owner,
const common::dataStructures::UserIdentity &owner,
const mode_t mode,
const uint64_t size);
/**
* The identity of the owner.
*/
UserIdentity owner;
common::dataStructures::UserIdentity owner;
/**
* The mode bits of the directory entry.
......
......@@ -16,29 +16,28 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "TapePoolQueue.hpp"
#include "ArchiveQueue.hpp"
#include "GenericObject.hpp"
#include "ProtocolBuffersAlgorithms.hpp"
#include "CreationLog.hpp"
#include "Tape.hpp"
#include "EntryLog.hpp"
#include "RootEntry.hpp"
#include <json-c/json.h>
cta::objectstore::TapePoolQueue::TapePoolQueue(const std::string& address, Backend& os):
ObjectOps<serializers::TapePoolQueue, serializers::TapePoolQueue_t>(os, address) { }
cta::objectstore::ArchiveQueue::ArchiveQueue(const std::string& address, Backend& os):
ObjectOps<serializers::ArchiveQueue, serializers::ArchiveQueue_t>(os, address) { }
cta::objectstore::TapePoolQueue::TapePoolQueue(GenericObject& go):
ObjectOps<serializers::TapePoolQueue, serializers::TapePoolQueue_t>(go.objectStore()) {
cta::objectstore::ArchiveQueue::ArchiveQueue(GenericObject& go):
ObjectOps<serializers::ArchiveQueue, serializers::ArchiveQueue_t>(go.objectStore()) {
// Here we transplant the generic object into the new object
go.transplantHeader(*this);
// And interpret the header.
getPayloadFromHeader();
}
std::string cta::objectstore::TapePoolQueue::dump() {
std::string cta::objectstore::ArchiveQueue::dump() {
checkPayloadReadable();
std::stringstream ret;
ret << "TapePoolQueue" << std::endl;
ret << "ArchiveQueue" << std::endl;
struct json_object * jo = json_object_new_object();
json_object_object_add(jo, "name", json_object_new_string(m_payload.tapepoolname().c_str()));
......@@ -48,9 +47,9 @@ std::string cta::objectstore::TapePoolQueue::dump() {
json_object * array = json_object_new_array();
for (auto i = m_payload.pendingarchivejobs().begin(); i!=m_payload.pendingarchivejobs().end(); i++) {
json_object * jot = json_object_new_object();
json_object_object_add(jot, "fileid", json_object_new_int64(i->fileid()));
json_object_object_add(jot, "address", json_object_new_string(i->address().c_str()));
json_object_object_add(jot, "copynb", json_object_new_int(i->copynb()));
json_object_object_add(jot, "path", json_object_new_string(i->path().c_str()));
json_object_object_add(jot, "size", json_object_new_int64(i->size()));
json_object_array_add(array, jot);
}
......@@ -60,9 +59,9 @@ std::string cta::objectstore::TapePoolQueue::dump() {
json_object * array = json_object_new_array();
for (auto i = m_payload.orphanedarchivejobsnscreation().begin(); i!=m_payload.orphanedarchivejobsnscreation().end(); i++) {
json_object * jot = json_object_new_object();
json_object_object_add(jot, "fileid", json_object_new_int64(i->fileid()));
json_object_object_add(jot, "address", json_object_new_string(i->address().c_str()));
json_object_object_add(jot, "copynb", json_object_new_int(i->copynb()));
json_object_object_add(jot, "path", json_object_new_string(i->path().c_str()));
json_object_object_add(jot, "size", json_object_new_int64(i->size()));
json_object_array_add(array, jot);
}
......@@ -72,9 +71,9 @@ std::string cta::objectstore::TapePoolQueue::dump() {
json_object * array = json_object_new_array();
for (auto i = m_payload.orphanedarchivejobsnsdeletion().begin(); i!=m_payload.orphanedarchivejobsnsdeletion().end(); i++) {
json_object * jot = json_object_new_object();
json_object_object_add(jot, "fileid", json_object_new_int64(i->fileid()));
json_object_object_add(jot, "address", json_object_new_string(i->address().c_str()));
json_object_object_add(jot, "copynb", json_object_new_int(i->copynb()));
json_object_object_add(jot, "path", json_object_new_string(i->path().c_str()));
json_object_object_add(jot, "size", json_object_new_int64(i->size()));
json_object_array_add(array, jot);
}
......@@ -85,9 +84,9 @@ std::string cta::objectstore::TapePoolQueue::dump() {
return ret.str();
}
void cta::objectstore::TapePoolQueue::initialize(const std::string& name) {
void cta::objectstore::ArchiveQueue::initialize(const std::string& name) {
// Setup underlying object
ObjectOps<serializers::TapePoolQueue, serializers::TapePoolQueue_t>::initialize();
ObjectOps<serializers::ArchiveQueue, serializers::ArchiveQueue_t>::initialize();
// Setup the object so it's valid
m_payload.set_tapepoolname(name);
// set the archive jobs counter to zero
......@@ -97,7 +96,7 @@ void cta::objectstore::TapePoolQueue::initialize(const std::string& name) {
m_payloadInterpreted = true;
}
bool cta::objectstore::TapePoolQueue::isEmpty() {
bool cta::objectstore::ArchiveQueue::isEmpty() {
checkPayloadReadable();
// Check we have no archive jobs pending
if (m_payload.pendingarchivejobs_size()
......@@ -108,7 +107,7 @@ bool cta::objectstore::TapePoolQueue::isEmpty() {
return true;
}
void cta::objectstore::TapePoolQueue::garbageCollect(const std::string &presumedOwner) {
void cta::objectstore::ArchiveQueue::garbageCollect(const std::string &presumedOwner) {
checkPayloadWritable();
// If the agent is not anymore the owner of the object, then only the very
// last operation of the tape pool creation failed. We have nothing to do.
......@@ -123,7 +122,7 @@ void cta::objectstore::TapePoolQueue::garbageCollect(const std::string &presumed
RootEntry re(m_objectStore);
ScopedSharedLock rel (re);
re.fetch();
auto tpd=re.dumpTapePoolQueues();
auto tpd=re.dumpArchiveQueues();
for (auto tp=tpd.begin(); tp!=tpd.end(); tp++) {
if (tp->address == getAddressIfSet()) {
setOwner(re.getAddressIfSet());
......@@ -135,23 +134,23 @@ void cta::objectstore::TapePoolQueue::garbageCollect(const std::string &presumed
// 2) The tape pool is not referenced by the root entry. It is then effectively
// not accessible and should be discarded.
if (!isEmpty()) {
throw (NotEmpty("Trying to garbage collect a non-empty TapePoolQueue: internal error"));
throw (NotEmpty("Trying to garbage collect a non-empty ArchiveQueue: internal error"));
}
remove();
}
void cta::objectstore::TapePoolQueue::setName(const std::string& name) {
void cta::objectstore::ArchiveQueue::setName(const std::string& name) {
checkPayloadWritable();
m_payload.set_tapepoolname(name);
}
std::string cta::objectstore::TapePoolQueue::getName() {
std::string cta::objectstore::ArchiveQueue::getName() {
checkPayloadReadable();
return m_payload.tapepoolname();
}
void cta::objectstore::TapePoolQueue::addJob(const ArchiveRequest::JobDump& job,
const std::string & archiveToFileAddress, const std::string & path,
void cta::objectstore::ArchiveQueue::addJob(const ArchiveRequest::JobDump& job,
const std::string & archiveToFileAddress, uint64_t fileid,
uint64_t size, uint64_t priority, time_t startTime) {
checkPayloadWritable();
// The tape pool gets the highest priority of its jobs
......@@ -166,11 +165,11 @@ void cta::objectstore::TapePoolQueue::addJob(const ArchiveRequest::JobDump& job,
auto * j = m_payload.add_pendingarchivejobs();
j->set_address(archiveToFileAddress);
j->set_size(size);
j->set_path(path);
j->set_fileid(fileid);
j->set_copynb(job.copyNb);
}
auto cta::objectstore::TapePoolQueue::getJobsSummary() -> JobsSummary {
auto cta::objectstore::ArchiveQueue::getJobsSummary() -> JobsSummary {
checkPayloadReadable();
JobsSummary ret;
ret.files = m_payload.pendingarchivejobs_size();
......@@ -179,10 +178,10 @@ auto cta::objectstore::TapePoolQueue::getJobsSummary() -> JobsSummary {
return ret;
}
bool cta::objectstore::TapePoolQueue::addJobIfNecessary(
bool cta::objectstore::ArchiveQueue::addJobIfNecessary(
const ArchiveRequest::JobDump& job,
const std::string& archiveToFileAddress,
const std::string & path, uint64_t size) {
uint64_t fileid, uint64_t size) {
checkPayloadWritable();
auto & jl=m_payload.pendingarchivejobs();
for (auto j=jl.begin(); j!= jl.end(); j++) {
......@@ -192,12 +191,12 @@ bool cta::objectstore::TapePoolQueue::addJobIfNecessary(
auto * j = m_payload.add_pendingarchivejobs();
j->set_address(archiveToFileAddress);
j->set_size(size);
j->set_path(path);
j->set_fileid(fileid);
j->set_copynb(job.copyNb);
return true;
}
void cta::objectstore::TapePoolQueue::removeJob(const std::string& archiveToFileAddress) {
void cta::objectstore::ArchiveQueue::removeJob(const std::string& archiveToFileAddress) {
checkPayloadWritable();
auto * jl=m_payload.mutable_pendingarchivejobs();
bool found = false;
......@@ -220,7 +219,7 @@ void cta::objectstore::TapePoolQueue::removeJob(const std::string& archiveToFile
} while (found);
}
auto cta::objectstore::TapePoolQueue::dumpJobs() -> std::list<JobDump> {
auto cta::objectstore::ArchiveQueue::dumpJobs() -> std::list<JobDump> {
checkPayloadReadable();
std::list<JobDump> ret;
auto & jl=m_payload.pendingarchivejobs();
......@@ -233,10 +232,10 @@ auto cta::objectstore::TapePoolQueue::dumpJobs() -> std::list<JobDump> {
return ret;
}
bool cta::objectstore::TapePoolQueue::addOrphanedJobPendingNsCreation(
bool cta::objectstore::ArchiveQueue::addOrphanedJobPendingNsCreation(
const ArchiveRequest::JobDump& job,
const std::string& archiveToFileAddress,
const std::string & path,
uint64_t fileid,
uint64_t size) {
checkPayloadWritable();
auto & jl=m_payload.orphanedarchivejobsnscreation();
......@@ -247,15 +246,15 @@ bool cta::objectstore::TapePoolQueue::addOrphanedJobPendingNsCreation(
auto * j = m_payload.add_orphanedarchivejobsnscreation();
j->set_address(archiveToFileAddress);
j->set_size(size);
j->set_path(path);
j->set_fileid(fileid);
j->set_copynb(job.copyNb);
return true;
}
bool cta::objectstore::TapePoolQueue::addOrphanedJobPendingNsDeletion(
bool cta::objectstore::ArchiveQueue::addOrphanedJobPendingNsDeletion(
const ArchiveRequest::JobDump& job,
const std::string& archiveToFileAddress,
const std::string & path, uint64_t size) {
uint64_t fileid, uint64_t size) {
checkPayloadWritable();
auto & jl=m_payload.orphanedarchivejobsnsdeletion();
for (auto j=jl.begin(); j!= jl.end(); j++) {
......@@ -265,6 +264,6 @@ bool cta::objectstore::TapePoolQueue::addOrphanedJobPendingNsDeletion(
auto * j = m_payload.add_orphanedarchivejobsnsdeletion();
j->set_address(archiveToFileAddress);
j->set_size(size);
j->set_path(path);
j->set_fileid(fileid);
return true;
}
\ No newline at end of file
......@@ -24,9 +24,9 @@
#include "objectstore/cta.pb.h"
#include "common/CreationLog.hpp"
#include "common/MountControl.hpp"
#include "ArchiveToFileRequest.hpp"
#include "ArchiveRequest.hpp"
#include "CreationLog.hpp"
#include "ArchiveRequest.hpp"
#include "EntryLog.hpp"
#include "Agent.hpp"
#include "common/archiveNS/Tape.hpp"
......@@ -34,13 +34,13 @@ namespace cta { namespace objectstore {
class GenericObject;
class TapePoolQueue: public ObjectOps<serializers::TapePoolQueue, serializers::TapePoolQueue_t> {
class ArchiveQueue: public ObjectOps<serializers::ArchiveQueue, serializers::ArchiveQueue_t> {
public:
// Constructor
TapePoolQueue(const std::string & address, Backend & os);
ArchiveQueue(const std::string & address, Backend & os);
// Upgrader form generic object
TapePoolQueue(GenericObject & go);
ArchiveQueue(GenericObject & go);
// In memory initialiser
void initialize(const std::string & name);
......@@ -51,23 +51,23 @@ public:
// Archive jobs management ===================================================
void addJob(const ArchiveRequest::JobDump & job,
const std::string & archiveToFileAddress, const std::string & path,
const std::string & archiveToFileAddress, uint64_t fileid,
uint64_t size, uint64_t priority, time_t startTime);
/// This version will check for existence of the job in the queue before
// returns true if a new job was actually inserted.
bool addJobIfNecessary(const ArchiveRequest::JobDump & job,
const std::string & archiveToFileAddress,
const std::string & path, uint64_t size);
uint64_t fileid, uint64_t size);
/// This version will check for existence of the job in the queue before
// returns true if a new job was actually inserted.
bool addOrphanedJobPendingNsCreation(const ArchiveRequest::JobDump& job,
const std::string& archiveToFileAddress, const std::string & path,
const std::string& archiveToFileAddress, uint64_t fileid,
uint64_t size);
/// This version will check for existence of the job in the queue before
// returns true if a new job was actually inserted.
bool addOrphanedJobPendingNsDeletion(const ArchiveRequest::JobDump& job,
const std::string& archiveToFileAddress,
const std::string & path, uint64_t size);
uint64_t fileid, uint64_t size);
struct JobsSummary {
uint64_t files;
......@@ -86,6 +86,10 @@ public:
};
std::list<JobDump> dumpJobs();
// Mount criteria jobs management ============================================
void setMountPolicy(const common::dataStructures::MountPolicy& mountPolicy);
common::dataStructures::MountPolicy getMountPolicy();
// Check that the tape pool is empty (of both tapes and jobs)
bool isEmpty();
......
......@@ -18,10 +18,12 @@
#include "ArchiveRequest.hpp"
#include "GenericObject.hpp"
#include "TapePool.hpp"
#include "ArchiveQueue.hpp"
#include "common/dataStructures/EntryLog.hpp"
#include <json-c/json.h>
namespace cta { namespace objectstore {
cta::objectstore::ArchiveRequest::ArchiveRequest(const std::string& address, Backend& os):
ObjectOps<serializers::ArchiveRequest, serializers::ArchiveRequest_t>(os, address){ }
......@@ -44,14 +46,14 @@ void cta::objectstore::ArchiveRequest::initialize() {
}
void cta::objectstore::ArchiveRequest::addJob(uint16_t copyNumber,
const std