Commit baae0287 authored by Bernd Lietzow's avatar Bernd Lietzow

buddyrecyner: Moved parentJob reference to sync slave base class

This is a preparation for early abort in ModSyncSlave
parent 76c77829
......@@ -32,10 +32,10 @@ BuddyResyncJob::BuddyResyncJob() :
for (size_t i = 0; i < numSyncSlaves; i++)
bulkSyncSlaves.emplace_back(
boost::make_unique<BuddyResyncerBulkSyncSlave>(&syncCandidates, i, buddyNodeID, *this));
boost::make_unique<BuddyResyncerBulkSyncSlave>(*this, &syncCandidates, i, buddyNodeID));
sessionStoreResyncer = boost::make_unique<SessionStoreResyncer>(buddyNodeID);
modSyncSlave = boost::make_unique<BuddyResyncerModSyncSlave>(&syncCandidates, 1, buddyNodeID);
modSyncSlave = boost::make_unique<BuddyResyncerModSyncSlave>(*this, &syncCandidates, 1, buddyNodeID);
}
BuddyResyncJob::~BuddyResyncJob() = default;
......
......@@ -12,10 +12,11 @@
#include <dirent.h>
BuddyResyncerBulkSyncSlave::BuddyResyncerBulkSyncSlave(MetaSyncCandidateStore* syncCandidates,
uint8_t slaveID, const NumNodeID& buddyNodeID, BuddyResyncJob& parentJob) :
SyncSlaveBase("BuddyResyncerBulkSyncSlave_" + StringTk::uintToStr(slaveID), buddyNodeID),
syncCandidates(syncCandidates), parentJob(&parentJob)
BuddyResyncerBulkSyncSlave::BuddyResyncerBulkSyncSlave(BuddyResyncJob& parentJob,
MetaSyncCandidateStore* syncCandidates, uint8_t slaveID, const NumNodeID& buddyNodeID) :
SyncSlaveBase("BuddyResyncerBulkSyncSlave_" + StringTk::uintToStr(slaveID), parentJob,
buddyNodeID),
syncCandidates(syncCandidates)
{
}
......
......@@ -18,8 +18,8 @@ class BuddyResyncerBulkSyncSlave : public SyncSlaveBase
friend class BuddyResyncJob;
public:
BuddyResyncerBulkSyncSlave(MetaSyncCandidateStore* syncCanditates, uint8_t slaveID,
const NumNodeID& buddyNodeID, BuddyResyncJob& parentJob);
BuddyResyncerBulkSyncSlave(BuddyResyncJob& parentJob, MetaSyncCandidateStore* syncCanditates, uint8_t slaveID,
const NumNodeID& buddyNodeID);
struct Stats
{
......@@ -37,7 +37,6 @@ class BuddyResyncerBulkSyncSlave : public SyncSlaveBase
private:
MetaSyncCandidateStore* syncCandidates;
BuddyResyncJob* parentJob;
AtomicUInt64 numDirsSynced;
AtomicUInt64 numFilesSynced;
......
......@@ -10,9 +10,10 @@
#include <program/Program.h>
#include <toolkit/XAttrTk.h>
BuddyResyncerModSyncSlave::BuddyResyncerModSyncSlave(MetaSyncCandidateStore* syncCandidates,
uint8_t slaveID, const NumNodeID& buddyNodeID) :
SyncSlaveBase("BuddyResyncerModSyncSlave_" + StringTk::uintToStr(slaveID), buddyNodeID),
BuddyResyncerModSyncSlave::BuddyResyncerModSyncSlave(BuddyResyncJob& parentJob,
MetaSyncCandidateStore* syncCandidates, uint8_t slaveID, const NumNodeID& buddyNodeID) :
SyncSlaveBase("BuddyResyncerModSyncSlave_" + StringTk::uintToStr(slaveID), parentJob,
buddyNodeID),
syncCandidates(syncCandidates)
{
}
......
......@@ -18,8 +18,8 @@ class BuddyResyncerModSyncSlave : public SyncSlaveBase
friend class BuddyResyncJob;
public:
BuddyResyncerModSyncSlave(MetaSyncCandidateStore* syncCanditates, uint8_t slaveID,
const NumNodeID& buddyNodeID);
BuddyResyncerModSyncSlave(BuddyResyncJob& parentJob, MetaSyncCandidateStore* syncCanditates,
uint8_t slaveID, const NumNodeID& buddyNodeID);
struct Stats
{
......
......@@ -28,6 +28,8 @@ class SyncSlaveBase : public PThread
}
protected:
BuddyResyncJob* parentJob;
NumNodeID buddyNodeID;
Mutex stateMutex;
......@@ -39,8 +41,9 @@ class SyncSlaveBase : public PThread
Path basePath;
SyncSlaveBase(const std::string& threadName, const NumNodeID buddyNodeID):
PThread(threadName), buddyNodeID(buddyNodeID), isRunning(false)
SyncSlaveBase(const std::string& threadName, BuddyResyncJob& parentJob,
const NumNodeID buddyNodeID):
PThread(threadName), parentJob(&parentJob), buddyNodeID(buddyNodeID), isRunning(false)
{
}
......
Markdown is supported
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