Skip to content
Snippets Groups Projects
Commit 39363098 authored by Eric Cano's avatar Eric Cano
Browse files

Work in progress: creating a sorter for the objects to garbage collect.

The generic objects will then be fetched lockfree in parallel, sorted from their memory copy in the sorter,

and then processed.
parent 00ff7f71
Branches
Tags
No related merge requests found
......@@ -146,7 +146,7 @@ public:
* (success or exception) will be returned via the wait() function call.
*/
class AsyncDeleter {
public:
public:
/**
* Waits for completion (success) of throws exception (failure).
*/
......@@ -167,6 +167,21 @@ public:
*/
virtual AsyncDeleter * asyncDelete(const std::string & name) = 0;
class AsyncLockfreeFetcher {
public:
/**
* Waits for completion (success) of throws exception (failure).
*/
virtual void wait() = 0;
/**
* Destructor
*/
virtual ~AsyncLockfreeFetcher() {}
};
virtual AsyncLockfreeFetcher * asyncLockfreeFetch (const std::string & name) = 0;
/**
* Base class for the representation of the parameters of the BackendStore.
*/
......
......@@ -190,8 +190,15 @@ void GarbageCollector::cleanupDeadAgent(const std::string & address, log::LogCon
}
lc.log(log::INFO, "In GarbageCollector::cleanupDeadAgent(): will cleanup dead agent.");
// Return all objects owned by the agent to their respective backup owners
auto ownedObjects = agent.getOwnershipList();
for (auto obj = ownedObjects.begin(); obj!= ownedObjects.end(); obj++) {
auto ownedObjectAddresses = agent.getOwnershipList();
// Parallel fetch (lock free) all the objects to assess their status (check ownership,
// type and decide to which queue they will go.
std::list<std::shared_ptr<GenericObject>> ownedObjects;
for (auto & obj : ownedObjectAddresses) {
// Create the generic objects and fetch them
ownedObjects.emplace_back(new GenericObject(obj, m_objectStore));
ownedObjects.back()->
// Find the object
GenericObject go(*obj, m_objectStore);
log::ScopedParamContainer params2(lc);
......
......@@ -23,6 +23,8 @@
#include "AgentWatchdog.hpp"
#include "AgentRegister.hpp"
#include "common/log/LogContext.hpp"
#include "ArchiveRequest.hpp"
#include "RetrieveRequest.hpp"
/**
* Plan => Garbage collector keeps track of the agents.
......@@ -49,6 +51,14 @@ public:
void cleanupDeadAgent(const std::string & name, log::LogContext & lc);
void reinjectOwnedObject(log::LogContext & lc);
/** Structure allowing the sorting of owned objects, so they can be requeued in batches,
* one batch per queue. */
struct OwnedObjectSorter {
std::map<std::string, std::list<std::shared_ptr <ArchiveRequest>>> archiveQueuesAndRequests;
std::map<std::string, std::list<std::shared_ptr <RetrieveRequest>>> retrieveQueuesAndRequests;
std::list<std::shared_ptr <Agent>> agents;
};
private:
Backend & m_objectStore;
catalogue::Catalogue & m_catalogue;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment