Pārlūkot izejas kodu

Replace WaitForFinishedInParentDirectory with WaitForFinished for directory moves

In preparation for the PropagateDirectory refactoring, simplify things
by removing WaitForFinishedInParentDirectory, which is currently
implemented as a one-level check.

This value is important for directory items, but is however never
used since a directory CSYNC_INSTRUCTION_RENAME item will always be in
PropagateDirectory::_firstJob, which will have to pass through its own
PropagateDirectory job's parallelism() before reaching the parent's
_subJobs optimization.
Since PropagateDirectory::parallelism can only return WaitForFinished
or FullParallelism, that value is lost. So this commit doesn't
change the behavior for directories, and allow file renames to be
scheduled in parallel across directories (which isn't a problem).
Jocelyn Turcotte 9 gadi atpakaļ
vecāks
revīzija
0b098045f1

+ 0 - 8
src/libsync/owncloudpropagator.cpp

@@ -621,16 +621,11 @@ bool PropagateDirectory::scheduleNextJob()
         return false;
     }
 
-    bool stopAtDirectory = false;
     for (int i = 0; i < _subJobs.size(); ++i) {
         if (_subJobs.at(i)->_state == Finished) {
             continue;
         }
 
-        if (stopAtDirectory && qobject_cast<PropagateDirectory*>(_subJobs.at(i))) {
-            return false;
-        }
-
         if (possiblyRunNextJob(_subJobs.at(i))) {
             return true;
         }
@@ -641,9 +636,6 @@ bool PropagateDirectory::scheduleNextJob()
         if (paral == WaitForFinished) {
             return false;
         }
-        if (paral == WaitForFinishedInParentDirectory) {
-            stopAtDirectory = true;
-        }
     }
     return false;
 }

+ 0 - 6
src/libsync/owncloudpropagator.h

@@ -76,12 +76,6 @@ public:
             So this job is guaranteed to finish before any jobs below it
             are executed. */
         WaitForFinished,
-
-        /** A job with this parallelism will allow later jobs to start and
-            run in parallel as long as they aren't PropagateDirectory jobs.
-            When the first directory job is encountered, no further jobs
-            will be started until this one is finished. */
-        WaitForFinishedInParentDirectory
     };
 
     virtual JobParallelism parallelism() { return FullParallelism; }

+ 1 - 1
src/libsync/propagateremotemove.h

@@ -54,7 +54,7 @@ public:
         : PropagateItemJob(propagator, item) {}
     void start() Q_DECL_OVERRIDE;
     void abort() Q_DECL_OVERRIDE;
-    JobParallelism parallelism() Q_DECL_OVERRIDE { return OCC::PropagatorJob::WaitForFinishedInParentDirectory; }
+    JobParallelism parallelism() Q_DECL_OVERRIDE { return _item->_isDirectory ? WaitForFinished : FullParallelism; }
 
     /**
      * Rename the directory in the selective sync list

+ 1 - 1
src/libsync/propagatorjobs.h

@@ -79,7 +79,7 @@ class PropagateLocalRename : public PropagateItemJob {
 public:
     PropagateLocalRename (OwncloudPropagator* propagator,const SyncFileItemPtr& item)  : PropagateItemJob(propagator, item) {}
     void start() Q_DECL_OVERRIDE;
-    JobParallelism parallelism() Q_DECL_OVERRIDE { return WaitForFinishedInParentDirectory; }
+    JobParallelism parallelism() Q_DECL_OVERRIDE { return _item->_isDirectory ? WaitForFinished : FullParallelism; }
 };
 
 }