diff options
author | Christian Kamm <mail@ckamm.de> | 2017-06-14 13:14:46 +0300 |
---|---|---|
committer | Christian Kamm <mail@ckamm.de> | 2017-06-15 14:54:16 +0300 |
commit | 816096311027bac0f391ea97d0b61b4175e9b8f9 (patch) | |
tree | 7ad93c6ac77711d82ff2453366bf3144385ed94f /test/testsyncjournaldb.cpp | |
parent | d50d8b86cf135dff833679b073406e4bdd6deae6 (diff) |
Compare the hash of files with identical mtime/size #5589
* For conflicts where mtime and size are identical:
a) If there's no remote checksum, skip (unchanged)
b) If there's a remote checksum that's a useful hash, create a
PropagateDownload job and compute the local hash. If the hashes
are identical, don't download the file and just update metadata.
* Avoid exposing the existence of checksumTypeId beyond the database
layer. This makes handling checksums easier in general because they
can usually be treated as a single blob.
This change was prompted by the difficulty of producing file_stat_t
entries uniformly from PROPFINDs and the database.
Diffstat (limited to 'test/testsyncjournaldb.cpp')
-rw-r--r-- | test/testsyncjournaldb.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/test/testsyncjournaldb.cpp b/test/testsyncjournaldb.cpp index fa6021acc..ec673077d 100644 --- a/test/testsyncjournaldb.cpp +++ b/test/testsyncjournaldb.cpp @@ -53,17 +53,15 @@ private slots: record._fileId = "abcd"; record._remotePerm = "744"; record._fileSize = 213089055; - record._contentChecksum = "mychecksum"; - record._contentChecksumType = "MD5"; + record._checksumHeader = "MD5:mychecksum"; QVERIFY(_db.setFileRecord(record)); SyncJournalFileRecord storedRecord = _db.getFileRecord("foo"); QVERIFY(storedRecord == record); // Update checksum - record._contentChecksum = "newchecksum"; - record._contentChecksumType = "Adler32"; - _db.updateFileRecordChecksum("foo", record._contentChecksum, record._contentChecksumType); + record._checksumHeader = "Adler32:newchecksum"; + _db.updateFileRecordChecksum("foo", "newchecksum", "Adler32"); storedRecord = _db.getFileRecord("foo"); QVERIFY(storedRecord == record); @@ -91,16 +89,14 @@ private slots: SyncJournalFileRecord record; record._path = "foo-checksum"; record._remotePerm = "744"; - record._contentChecksum = "mychecksum"; - record._contentChecksumType = "MD5"; + record._checksumHeader = "MD5:mychecksum"; record._modtime = QDateTime::currentDateTimeUtc(); QVERIFY(_db.setFileRecord(record)); SyncJournalFileRecord storedRecord = _db.getFileRecord("foo-checksum"); QVERIFY(storedRecord._path == record._path); QVERIFY(storedRecord._remotePerm == record._remotePerm); - QVERIFY(storedRecord._contentChecksum == record._contentChecksum); - QVERIFY(storedRecord._contentChecksumType == record._contentChecksumType); + QVERIFY(storedRecord._checksumHeader == record._checksumHeader); // qDebug()<< "OOOOO " << storedRecord._modtime.toTime_t() << record._modtime.toTime_t(); |