Remove the tainted folder logic

This currently is no-op code since the socket API isn't notified
that the tainted folder list changed, and the result is the same
since a sync will be triggered within the next 5 seconds and the
modified folder will be shown as SYNC at that point anyway.

Removing the dependency to the file watcher allows moving the
status estimation logic to libsync.
This commit is contained in:
Jocelyn Turcotte 2016-03-17 19:38:44 +01:00
parent c090a511fd
commit 6d3fe9d865
3 changed files with 0 additions and 42 deletions

View file

@ -626,10 +626,6 @@ void Folder::slotThreadTreeWalkResult(const SyncFileItemVector& items)
void Folder::slotAboutToPropagate(SyncFileItemVector& items) void Folder::slotAboutToPropagate(SyncFileItemVector& items)
{ {
// empty the tainted list since the status generation code will use the _syncedItems
// (which imply the folder) to generate the syncing state icon now.
_stateTaintedFolders.clear();
addErroredSyncItemPathsToList(items, &this->_stateLastSyncItemsWithErrorNew); addErroredSyncItemPathsToList(items, &this->_stateLastSyncItemsWithErrorNew);
} }
@ -648,14 +644,6 @@ bool Folder::estimateState(QString fn, csync_ftw_type_e t, SyncFileStatus* s)
return true; return true;
} }
} }
if(!fn.endsWith(QLatin1Char('/'))) {
fn.append(QLatin1Char('/'));
}
if (Utility::doesSetContainPrefix(_stateTaintedFolders, fn)) {
qDebug() << Q_FUNC_INFO << "Folder is tainted, EVAL!" << fn;
s->set(SyncFileStatus::STATUS_EVAL);
return true;
}
return false; return false;
} else if ( t== CSYNC_FTW_TYPE_FILE) { } else if ( t== CSYNC_FTW_TYPE_FILE) {
// check if errorList has the directory/file // check if errorList has the directory/file
@ -700,31 +688,6 @@ bool Folder::isFileExcludedRelative(const QString& relativePath) const
return _engine->excludedFiles().isExcluded(path() + relativePath, path(), _definition.ignoreHiddenFiles); return _engine->excludedFiles().isExcluded(path() + relativePath, path(), _definition.ignoreHiddenFiles);
} }
void Folder::watcherSlot(QString fn)
{
// FIXME: On OS X we could not do this "if" since on OS X the file watcher ignores events for ourselves
// however to have the same behaviour atm on all platforms, we don't do it
if (_engine->isSyncRunning()) {
qDebug() << Q_FUNC_INFO << "Sync running, IGNORE event for " << fn;
return;
}
QFileInfo fi(fn);
if (fi.isFile()) {
fn = fi.path(); // depending on OS, file watcher might be for dir or file
}
// Make it a relative path depending on the folder
QString relativePath = fn.remove(0, path().length());
if( !relativePath.endsWith(QLatin1Char('/'))) {
relativePath.append(QLatin1Char('/'));
}
qDebug() << Q_FUNC_INFO << fi.canonicalFilePath() << fn << relativePath;
_stateTaintedFolders.insert(relativePath);
// Notify the SocketAPI?
}
void Folder::slotTerminateSync() void Folder::slotTerminateSync()
{ {
qDebug() << "folder " << alias() << " Terminating!"; qDebug() << "folder " << alias() << " Terminating!";
@ -913,7 +876,6 @@ void Folder::slotSyncFinished(bool success)
// This is for sync state calculation // This is for sync state calculation
_stateLastSyncItemsWithError = _stateLastSyncItemsWithErrorNew; _stateLastSyncItemsWithError = _stateLastSyncItemsWithErrorNew;
_stateLastSyncItemsWithErrorNew.clear(); _stateLastSyncItemsWithErrorNew.clear();
_stateTaintedFolders.clear(); // heuristic: assume the sync had been done, new file watches needed to taint dirs
if (_csyncError) { if (_csyncError) {
_syncResult.setStatus(SyncResult::Error); _syncResult.setStatus(SyncResult::Error);

View file

@ -267,7 +267,6 @@ private slots:
void slotEmitFinishedDelayed(); void slotEmitFinishedDelayed();
void watcherSlot(QString);
void slotNewBigFolderDiscovered(const QString &); void slotNewBigFolderDiscovered(const QString &);
private: private:

View file

@ -147,9 +147,6 @@ void FolderMan::registerFolderMonitor( Folder *folder )
// is lost this way, but we do not need it for the current implementation. // is lost this way, but we do not need it for the current implementation.
connect(fw, SIGNAL(pathChanged(QString)), folder, SLOT(slotWatchedPathChanged(QString))); connect(fw, SIGNAL(pathChanged(QString)), folder, SLOT(slotWatchedPathChanged(QString)));
_folderWatchers.insert(folder->alias(), fw); _folderWatchers.insert(folder->alias(), fw);
// This is at the moment only for the behaviour of the SocketApi.
connect(fw, SIGNAL(pathChanged(QString)), folder, SLOT(watcherSlot(QString)));
} }
// register the folder with the socket API // register the folder with the socket API