VirtualSyncSource, MapSyncSource: implement m_isEmpty
This is relevant for isUsable() and not so much (not at all?) for slow sync prevention.
This commit is contained in:
parent
8ac69096e8
commit
dec741ea50
|
@ -56,6 +56,7 @@ MapSyncSource::MapSyncSource(const SyncSourceParams ¶ms,
|
|||
m_operations.m_backupData = m_sub->getOperations().m_backupData;
|
||||
m_operations.m_restoreData = m_sub->getOperations().m_restoreData;
|
||||
}
|
||||
m_operations.m_isEmpty = m_sub->getOperations().m_isEmpty;
|
||||
}
|
||||
|
||||
void MapSyncSource::enableServerMode()
|
||||
|
|
|
@ -536,6 +536,8 @@ VirtualSyncSource::VirtualSyncSource(const SyncSourceParams ¶ms, SyncConfig
|
|||
evoSyncSource.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
m_operations.m_isEmpty = boost::bind(&VirtualSyncSource::isEmpty, this);
|
||||
}
|
||||
|
||||
void VirtualSyncSource::open()
|
||||
|
@ -546,6 +548,27 @@ void VirtualSyncSource::open()
|
|||
}
|
||||
}
|
||||
|
||||
bool VirtualSyncSource::isEmpty()
|
||||
{
|
||||
bool empty = true;
|
||||
SuspendFlags &s = SuspendFlags::getSuspendFlags();
|
||||
|
||||
BOOST_FOREACH(boost::shared_ptr<SyncSource> &source, m_sources) {
|
||||
// Operation might not be implemented, in which case we have to
|
||||
// assume "not empty".
|
||||
if (!source->getOperations().m_isEmpty ||
|
||||
!source->getOperations().m_isEmpty()) {
|
||||
empty = false;
|
||||
// Keep checking, because isEmpty() is also used for
|
||||
// isUsable() and we have to touch all sources for that.
|
||||
}
|
||||
// Operation might have been aborted by user, need to check.
|
||||
s.checkForNormal();
|
||||
}
|
||||
return empty;
|
||||
}
|
||||
|
||||
|
||||
void VirtualSyncSource::close()
|
||||
{
|
||||
BOOST_FOREACH(boost::shared_ptr<SyncSource> &source, m_sources) {
|
||||
|
|
|
@ -2230,6 +2230,7 @@ class DummySyncSource : public SyncSource
|
|||
class VirtualSyncSource : public DummySyncSource
|
||||
{
|
||||
std::vector< boost::shared_ptr<SyncSource> > m_sources;
|
||||
bool isEmpty();
|
||||
|
||||
public:
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue