[Pkg-owncloud-commits] [owncloud-client] 18/70: SyncEngine: Use QSet for the seenFiles rather than QHash.

Sandro Knauß hefee-guest at moszumanska.debian.org
Tue Jul 1 10:21:19 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit b71881d3003ba89a9e5a19dd538238edee514e9d
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Tue Jun 17 16:29:38 2014 +0200

    SyncEngine: Use QSet for the seenFiles rather than QHash.
    
    We can save some memory here as the seenFiles list can be long.
---
 src/mirall/syncengine.cpp    | 3 ++-
 src/mirall/syncengine.h      | 3 ++-
 src/mirall/syncjournaldb.cpp | 2 +-
 src/mirall/syncjournaldb.h   | 2 +-
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/mirall/syncengine.cpp b/src/mirall/syncengine.cpp
index 3e5c6c9..b5f4fcc 100644
--- a/src/mirall/syncengine.cpp
+++ b/src/mirall/syncengine.cpp
@@ -265,7 +265,7 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
     item._fileId = file->file_id;
 
     // record the seen files to be able to clean the journal later
-    _seenFiles[item._file] = QString();
+    _seenFiles.insert(item._file);
 
     switch(file->error_status) {
     case CSYNC_STATUS_OK:
@@ -655,6 +655,7 @@ void SyncEngine::slotFinished()
     if( ! _journal->postSyncCleanup( _seenFiles ) ) {
         qDebug() << "Cleaning of synced ";
     }
+
     _journal->commit("All Finished.", false);
     emit treeWalkResult(_syncedItems);
     finalize();
diff --git a/src/mirall/syncengine.h b/src/mirall/syncengine.h
index 5f9c6e1..691c1c5 100644
--- a/src/mirall/syncengine.h
+++ b/src/mirall/syncengine.h
@@ -21,6 +21,7 @@
 #include <QMutex>
 #include <QThread>
 #include <QString>
+#include <QSet>
 #include <qelapsedtimer.h>
 
 #include <csync.h>
@@ -115,7 +116,7 @@ private:
     SyncJournalDb *_journal;
     QScopedPointer <OwncloudPropagator> _propagator;
     QString _lastDeleted; // if the last item was a path and it has been deleted
-    QHash <QString, QString> _seenFiles;
+    QSet<QString> _seenFiles;
     QThread _thread;
 
     Progress::Info _progressInfo;
diff --git a/src/mirall/syncjournaldb.cpp b/src/mirall/syncjournaldb.cpp
index 143637c..9567669 100644
--- a/src/mirall/syncjournaldb.cpp
+++ b/src/mirall/syncjournaldb.cpp
@@ -491,7 +491,7 @@ SyncJournalFileRecord SyncJournalDb::getFileRecord( const QString& filename )
     return rec;
 }
 
-bool SyncJournalDb::postSyncCleanup(const QHash<QString, QString> &items )
+bool SyncJournalDb::postSyncCleanup(const QSet<QString> &items )
 {
     QMutexLocker locker(&_mutex);
 
diff --git a/src/mirall/syncjournaldb.h b/src/mirall/syncjournaldb.h
index 097c297..6663df8 100644
--- a/src/mirall/syncjournaldb.h
+++ b/src/mirall/syncjournaldb.h
@@ -79,7 +79,7 @@ public:
      */
     void avoidReadFromDbOnNextSync(const QString& fileName);
 
-    bool postSyncCleanup( const QHash<QString, QString>& items );
+    bool postSyncCleanup( const QSet<QString>& items );
 
     /* Because sqlite transactions is really slow, we encapsulate everything in big transactions
      * Commit will actually commit the transaction and create a new one.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list