Commit 6ec8935b authored by Michael Davis's avatar Michael Davis
Browse files

[os-generic-queues] Renames ArchiveQueue to ArchiveQueueToTransfer

parent f2675143
......@@ -116,7 +116,7 @@ TEST(ObjectStore, ArchiveQueueAlgorithms) {
rel.release();
agent.initialize();
agent.insertAndRegisterSelf(lc);
ContainerAlgorithms<ArchiveQueue,ArchiveQueue>::InsertedElement::list requests;
ContainerAlgorithms<ArchiveQueue,ArchiveQueueToTransfer>::InsertedElement::list requests;
std::list<std::unique_ptr<cta::objectstore::ArchiveRequest>> archiveRequests;
for (size_t i=0; i<10; i++) {
std::string arAddr = agentRef.nextId("ArchiveRequest");
......@@ -135,7 +135,7 @@ TEST(ObjectStore, ArchiveQueueAlgorithms) {
aFile.fileSize = 667;
aFile.storageClass = "sc";
archiveRequests.emplace_back(new cta::objectstore::ArchiveRequest(arAddr, be));
requests.emplace_back(ContainerAlgorithms<ArchiveQueue,ArchiveQueue>::InsertedElement{archiveRequests.back().get(), 1, aFile, mp,
requests.emplace_back(ContainerAlgorithms<ArchiveQueue,ArchiveQueueToTransfer>::InsertedElement{archiveRequests.back().get(), 1, aFile, mp,
cta::nullopt});
auto & ar=*requests.back().archiveRequest;
auto copyNb = requests.back().copyNb;
......@@ -150,10 +150,10 @@ TEST(ObjectStore, ArchiveQueueAlgorithms) {
ar.setEntryLog(cta::common::dataStructures::EntryLog("user0", "host0", time(nullptr)));
ar.insert();
}
ContainerAlgorithms<ArchiveQueue,ArchiveQueue> archiveAlgos(be, agentRef);
ContainerAlgorithms<ArchiveQueue,ArchiveQueueToTransfer> archiveAlgos(be, agentRef);
archiveAlgos.referenceAndSwitchOwnership("Tapepool", QueueType::JobsToTransfer, requests, lc);
// Now get the requests back
ContainerTraits<ArchiveQueue,ArchiveQueue>::PopCriteria popCriteria;
ContainerTraits<ArchiveQueue,ArchiveQueueToTransfer>::PopCriteria popCriteria;
popCriteria.bytes = std::numeric_limits<decltype(popCriteria.bytes)>::max();
popCriteria.files = 100;
auto poppedJobs = archiveAlgos.popNextBatch("Tapepool", QueueType::JobsToTransfer, popCriteria, lc);
......
......@@ -138,6 +138,11 @@ public:
static const uint64_t c_maxShardSize = 25000;
};
class ArchiveQueueToTransfer: public ArchiveQueue {
public:
template<typename...Ts> ArchiveQueueToTransfer(Ts&...args): ArchiveQueue(args...) {}
};
class ArchiveQueueToReport: public ArchiveQueue {
public:
template<typename...Ts> ArchiveQueueToReport(Ts&...args): ArchiveQueue(args...) {}
......
......@@ -437,7 +437,7 @@ getElementSummary(const PoppedElement& poppedElement) -> PoppedElementsSummary {
// ArchiveQueue full specialisations for ContainerTraits.
template<>
struct ContainerTraits<ArchiveQueue,ArchiveQueue>::PopCriteria {
struct ContainerTraits<ArchiveQueue,ArchiveQueueToTransfer>::PopCriteria {
uint64_t files;
uint64_t bytes;
PopCriteria(uint64_t f = 0, uint64_t b = 0) : files(f), bytes(b) {}
......@@ -450,7 +450,7 @@ struct ContainerTraits<ArchiveQueue,ArchiveQueue>::PopCriteria {
};
template<>
struct ContainerTraits<ArchiveQueue,ArchiveQueue>::PoppedElementsSummary {
struct ContainerTraits<ArchiveQueue,ArchiveQueueToTransfer>::PoppedElementsSummary {
uint64_t files;
uint64_t bytes;
PoppedElementsSummary(uint64_t f = 0, uint64_t b = 0) : files(f), bytes(b) {}
......
......@@ -24,13 +24,13 @@ namespace cta { namespace objectstore {
// ArchiveQueue full specialisations for ContainerTraits.
template<>
const std::string ContainerTraits<ArchiveQueue,ArchiveQueue>::c_containerTypeName = "ArchiveQueue";
const std::string ContainerTraits<ArchiveQueue,ArchiveQueueToTransfer>::c_containerTypeName = "ArchiveQueueToTransfer";
template<>
const std::string ContainerTraits<ArchiveQueue,ArchiveQueue>::c_identifierType = "tapepool";
const std::string ContainerTraits<ArchiveQueue,ArchiveQueueToTransfer>::c_identifierType = "tapepool";
template<>
auto ContainerTraits<ArchiveQueue,ArchiveQueue>::
auto ContainerTraits<ArchiveQueue,ArchiveQueueToTransfer>::
getContainerSummary(Container& cont) -> ContainerSummary {
ContainerSummary ret;
ret.JobsSummary::operator=(cont.getJobsSummary());
......@@ -38,7 +38,7 @@ getContainerSummary(Container& cont) -> ContainerSummary {
}
template<>
auto ContainerTraits<ArchiveQueue,ArchiveQueue>::
auto ContainerTraits<ArchiveQueue,ArchiveQueueToTransfer>::
getPoppingElementsCandidates(Container &cont, PopCriteria &unfulfilledCriteria, ElementsToSkipSet &elemtsToSkip,
log::LogContext& lc) -> PoppedElementsBatch
{
......@@ -54,7 +54,7 @@ getPoppingElementsCandidates(Container &cont, PopCriteria &unfulfilledCriteria,
}
template<>
auto ContainerTraits<ArchiveQueue,ArchiveQueue>::
auto ContainerTraits<ArchiveQueue,ArchiveQueueToTransfer>::
getElementSummary(const PoppedElement& poppedElement) -> PoppedElementsSummary {
PoppedElementsSummary ret;
ret.bytes = poppedElement.bytes;
......@@ -63,14 +63,14 @@ getElementSummary(const PoppedElement& poppedElement) -> PoppedElementsSummary {
}
template<>
void ContainerTraits<ArchiveQueue,ArchiveQueue>::PoppedElementsBatch::
void ContainerTraits<ArchiveQueue,ArchiveQueueToTransfer>::PoppedElementsBatch::
addToLog(log::ScopedParamContainer &params) {
params.add("bytes", summary.bytes)
.add("files", summary.files);
}
template<>
void ContainerTraits<ArchiveQueue,ArchiveQueue>::
void ContainerTraits<ArchiveQueue,ArchiveQueueToTransfer>::
trimContainerIfNeeded(Container &cont, ScopedExclusiveLock &contLock, const ContainerIdentifier &cId,
log::LogContext &lc)
{
......
......@@ -60,9 +60,9 @@ add_library (ctaobjectstore SHARED
AgentWatchdog.cpp
ArchiveQueue.cpp
ArchiveQueueShard.cpp
ArchiveQueueAlgorithms.cpp
ArchiveQueueFailedAlgorithms.cpp
ArchiveQueueToTransferAlgorithms.cpp
ArchiveQueueToReportAlgorithms.cpp
ArchiveQueueFailedAlgorithms.cpp
RetrieveQueue.cpp
RetrieveQueueShard.cpp
RetrieveQueueAlgorithms.cpp
......
......@@ -399,7 +399,7 @@ void GarbageCollector::OwnedObjectSorter::lockFetchAndUpdateArchiveJobs(Agent& a
requestsList.pop_front();
}
utils::Timer t;
typedef ContainerAlgorithms<ArchiveQueue,ArchiveQueue> AqAlgos;
typedef ContainerAlgorithms<ArchiveQueue,ArchiveQueueToTransfer> AqAlgos;
AqAlgos aqcl(objectStore, agentReference);
decltype(aqcl)::InsertedElement::list jobsToAdd;
for (auto & ar: currentJobBatch) {
......
......@@ -33,7 +33,10 @@ class AgentReference;
class ScopedLock;
class ScopedExclusiveLock;
template<typename Q,typename C> struct ContainerTraits;
// Defined queue types
struct ArchiveQueue;
struct ArchiveQueueToTransfer;
struct ArchiveQueueToReport;
struct ArchiveQueueFailed;
struct RetrieveQueue;
......@@ -44,7 +47,7 @@ class ObjectOpsBase {
friend class ScopedExclusiveLock;
friend class GenericObject;
friend class Helpers;
friend ContainerTraits<ArchiveQueue,ArchiveQueue>;
friend ContainerTraits<ArchiveQueue,ArchiveQueueToTransfer>;
friend ContainerTraits<ArchiveQueue,ArchiveQueueToReport>;
friend ContainerTraits<ArchiveQueue,ArchiveQueueFailed>;
friend ContainerTraits<RetrieveQueue,RetrieveQueue>;
......
......@@ -1742,7 +1742,7 @@ const SchedulerDatabase::ArchiveMount::MountInfo& OStoreDB::ArchiveMount::getMou
//------------------------------------------------------------------------------
std::list<std::unique_ptr<SchedulerDatabase::ArchiveJob> > OStoreDB::ArchiveMount::getNextJobBatch(uint64_t filesRequested,
uint64_t bytesRequested, log::LogContext& logContext) {
typedef objectstore::ContainerAlgorithms<ArchiveQueue,ArchiveQueue> AQAlgos;
typedef objectstore::ContainerAlgorithms<ArchiveQueue,ArchiveQueueToTransfer> AQAlgos;
AQAlgos aqAlgos(m_oStoreDB.m_objectStore, *m_oStoreDB.m_agentReference);
AQAlgos::PopCriteria popCriteria(filesRequested, bytesRequested);
auto jobs = aqAlgos.popNextBatch(mountInfo.tapePool, objectstore::QueueType::JobsToTransfer, popCriteria, logContext);
......@@ -2137,7 +2137,7 @@ void OStoreDB::ArchiveJob::failTransfer(const std::string& failureReason, log::L
auto retryStatus = m_archiveRequest.getRetryStatus(tapeFile.copyNb);
m_archiveRequest.commit();
arl.release();
typedef objectstore::ContainerAlgorithms<ArchiveQueue,ArchiveQueue> CaAqtr;
typedef objectstore::ContainerAlgorithms<ArchiveQueue,ArchiveQueueToTransfer> CaAqtr;
CaAqtr caAqtr(m_oStoreDB.m_objectStore, *m_oStoreDB.m_agentReference);
CaAqtr::InsertedElement::list insertedElements;
insertedElements.push_back(CaAqtr::InsertedElement{&m_archiveRequest, tapeFile.copyNb, archiveFile, cta::nullopt, cta::nullopt });
......
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