QTimer::singleShot(0, _discoveryData, &DiscoveryPhase::scheduleMoreJobs);
}
-int ProcessDirectoryJob::progress(int nbJobs)
+int ProcessDirectoryJob::processSubJobs(int nbJobs)
{
if (_queuedJobs.empty() && _runningJobs.empty() && _pendingAsyncJobs == 0) {
_pendingAsyncJobs = -1; // We're finished, we don't want to emit finished again
int started = 0;
foreach (auto *rj, _runningJobs) {
- started += rj->progress(nbJobs - started);
+ started += rj->processSubJobs(nbJobs - started);
if (started >= nbJobs)
return started;
}
class SyncJournalDb;
/**
- * Job that handle the discovering of a directory.
+ * Job that handles the discovering of a directory.
*
* This includes:
* - Do a DiscoverySingleDirectoryJob network job which will do a PROPFIND of this directory
* - Stat all the entries in the local file system for this directory
- * - Merge all invormation (and the information from the database) in order to know what need
+ * - Merge all information (and the information from the database) in order to know what needs
* to be done for every file within this directory.
* - For every sub-directory within this directory, "recursively" create a new ProcessDirectoryJob
*
- * This job is tightly couple with the DiscoveryPhase class.
+ * This job is tightly coupled with the DiscoveryPhase class.
*
- * After being start()'ed, one must call progress() on this job until it emit finished().
+ * After being start()'ed, one must call processSubJobs() on this job until it emits finished().
* This job will call DiscoveryPhase::scheduleMoreJobs when one of its sub-jobs is finished.
- * DiscoveryPhase::scheduleMoreJobs is the one which will call progress().
+ * DiscoveryPhase::scheduleMoreJobs is the one which will call processSubJobs().
+ * Results are fed outwards via DiscoveryPhase::itemDiscovered
*/
class ProcessDirectoryJob : public QObject
{
}
void start();
/** Start up to nbJobs, return the number of job started */
- int progress(int nbJobs);
+ int processSubJobs(int nbJobs);
SyncFileItemPtr _dirItem;
return result;
}
};
+ // Called once _serverEntries and _localEntries are filled
void process();
// return true if the file is excluded
bool handleExcluded(const QString &path, bool isDirectory, bool isHidden, bool isSymlink);
{
auto limit = qMax(1, _syncOptions._parallelNetworkJobs);
if (_currentRootJob && _currentlyActiveJobs < limit) {
- _currentRootJob->progress(limit - _currentlyActiveJobs);
+ _currentRootJob->processSubJobs(limit - _currentlyActiveJobs);
}
}
ProcessDirectoryJob *_currentRootJob = nullptr;
+ friend class ProcessDirectoryJob;
+ QMap<QString, SyncFileItemPtr> _deletedItem;
+ QMap<QString, ProcessDirectoryJob *> _queuedDeletedDirectories;
+ QMap<QString, QString> _renamedItems; // map source -> destinations
+ int _currentlyActiveJobs = 0;
+
public:
QString _localDir; // absolute path to the local directory. ends with '/'
QString _remoteFolder; // remote folder, ends with '/'
QStringList _selectiveSyncWhiteList;
ExcludedFiles *_excludes;
QString _invalidFilenamePattern; // FIXME: maybe move in ExcludedFiles
- int _currentlyActiveJobs = 0;
bool _ignoreHiddenFiles = false;
std::function<bool(const QString &)> _shouldDiscoverLocaly;
void checkSelectiveSyncNewFolder(const QString &path, RemotePermissions rp,
std::function<void(bool)> callback);
- QMap<QString, SyncFileItemPtr> _deletedItem;
- QMap<QString, ProcessDirectoryJob *> _queuedDeletedDirectories;
- QMap<QString, QString> _renamedItems; // map source -> destinations
/** Given an original path, return the target path obtained when renaming is done.
*
* Note that it only considers parent directory renames. So if A/B got renamed to C/D,