Commit Graph

62 Commits

Author SHA1 Message Date
alex-z 50ffc7373f Update file's metadata in the local database when the etag changes while file remains unchanged. Fix subsequent conflict when locking and unlocking.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2022-12-30 16:57:32 +01:00
Matthieu Gallien 565a5f0999 add [[nodiscard]] attribute via clang-tidy
ran
run-clang-tidy-14.py -header-filter='.*' -checks='-*,modernize-use-nodiscard' -fix
under linux with most part of our code covered

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2022-10-04 11:14:45 +02:00
alex-z 225753a8c0 Refactor DeleteJob and DeleteApiJob to use SimpleFileJob.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2022-01-11 13:37:09 +00:00
alex-z 190d278fd4 Checksum validation PropagateDownload unit tests.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2022-01-11 13:37:09 +00:00
alex-z b7be10f712 Ask server to recalculate checksum on validatin failure.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2022-01-11 13:37:09 +00:00
Matthieu Gallien c194605c35 implement bulk upload
add PutMultiFileJob to send many files at once

use it in BulkPropagatorJob to implement bulk upload feature

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-11-24 16:17:47 +01:00
Matthieu Gallien 25669938fd let clang-tidy add missing override after enabling again the check
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-08-31 08:35:56 +00:00
allexzander ba73b6d914 VFS + E2EE. Improved data alignment and unit tests for StreamingDecryptor. Refactoring and renaming for readability.
Signed-off-by: allexzander <blackslayer4@gmail.com>
2021-08-20 12:57:22 +00:00
allexzander 2c78925acb VFS + E2EE VFS implicit hydration of E2EE files.
Signed-off-by: allexzander <blackslayer4@gmail.com>
2021-08-20 12:57:22 +00:00
allexzander 8122c63ebc Revert Added config parameter that allows to bypass checksum validation failure.
Signed-off-by: allexzander <blackslayer4@gmail.com>
2021-07-28 07:57:10 +00:00
Matthieu Gallien 8ad6f89fed bring back dynamic load of VFS plugins
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-07-08 08:11:17 +00:00
Felix Weilbach c799dbdd61 Cfapi: Make sure no data is transfered after cancellation
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
2021-06-17 09:10:06 +00:00
allexzander dc72686ab3 Allow download with mismatched checksum if a config option is set.
Signed-off-by: allexzander <blackslayer4@gmail.com>
2021-06-10 13:39:11 +03:00
Felix Weilbach 9bf5b5c7ba CFAPI: Handle cancelation of hydration requests
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
2021-03-18 10:43:48 +00:00
Christian Kamm 4c04351360
Fix warnings about signedness
Sizes are always qint64, not unsigned.
TransferIds are always uint.
2020-12-15 10:58:41 +01:00
Christian Kamm 1ed005aafe
winvfs: Better error reporting
- fix download and validation error reporting
- add tests
2020-12-15 10:58:22 +01:00
Christian Kamm 2b20985875
winvfs: initial work
Done by ckamm and dschmidt
2020-12-15 10:58:21 +01:00
Olivier Goffart 35967fc2d6
OAuth2: Refresh the token without aborting the sync
OAuth2 access token typically only has a token valid for 1 hour.
Before this patch, when the token was timing out during the sync, the
sync was aborted, and the ConnectionValidator was then requesting a new
token, so the sync can be started over.
If the discovery takes longer than the oauth2 validity, this means that
the sync can never proceed, as it would be always restarted from scratch.

With this patch, we try to transparently renew the OAuth2 token and restart
the jobs that failed because the access token was invalid.

Note that some changes were required in the GETFile job because it handled
the error itself and so it was erroring the jobs before its too late.

Issue #6814
2020-12-15 10:58:14 +01:00
J-P Nurmi 1af9bf8abc libsync: run clang-tidy modernize-use-nullptr 2018-11-12 18:46:39 +01:00
J-P Nurmi 0d1c15a768 libsync: run clang-tidy modernize-use-override 2018-11-12 18:43:58 +01:00
J-P Nurmi 48acaec66f libsync: search'n'replace "Q_DECL_OVERRIDE" with "override" 2018-11-12 18:39:50 +01:00
Tomaz Canabrava d24a1e542e Merge branch 'master' into clientSideEncryptionV3 2018-01-29 14:06:12 +01:00
Tomaz Canabrava 009562da1e [CSE] Remove lambas with lambdas
It's hard to reason with lambdas with lambdas, so transform
them into actuall signal / slot calls.
2018-01-21 21:25:06 +01:00
Daniel Nicoletti a7ee1a95a6 Download and decrypt file if parent folder is marked as encrypted 2018-01-08 21:08:31 +01:00
Christian Kamm a7c0cfc8eb Upload conflict files #4557
If the server has the 'uploadConflictFiles' capability conflict
files will be uploaded instead of ignored.

Uploaded conflict files have the following headers set during upload
  OC-Conflict: 1
  OC-ConflictBaseFileId: 172489174instanceid
  OC-ConflictBaseMtime: 1235789213
  OC-ConflictBaseEtag: myetag
when the data is available. Downloads accept the same headers in return
when downloading a conflict file.

In the absence of server support clients will identify conflict files
through the file name pattern and attempt to deduce the base fileid.
Base etag and mtime can't be deduced though.

The upload job for a new conflict file will be triggered directly from
the job that created the conflict file now. No second sync run is
necessary anymore.

This commit does not yet introduce a 'username' like identifier that
automatically gets added to conflict file filenames (to name the files
foo_conflict-Fred-1345.txt instead of just foo_conflict-1345.txt).
2017-12-15 18:03:53 +01:00
Christian Kamm bff24ffd2f PropagateDownload: Fix GET with redirects #6159
The GET jobs were redirected, but the custom incremental handling
in readyRead didn't propagate to the follow-up job.
2017-11-15 10:11:15 +01:00
Piotr Mrowczynski e10775d34f Fix paused sync file move issue #5949
Dont abort final chunk immedietally

Use sync and async aborts
2017-10-17 09:44:52 +02:00
Christian Kamm 8160963110 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.
2017-06-15 13:54:16 +02:00
Christian Kamm c8d0f788e0 Apply clang-format 2017-05-17 12:26:27 +02:00
Jocelyn Turcotte 4ad190a558 Use Qt logging categories for logging
This gives more insight about the logs and allow setting fine-tuned
logging rules. The categories are set to only output Info by default
so this allows us to provide more concise logging while keeping the
ability to extract more information for a specific category when
developping or debugging customer issues.

Issue #5647
2017-05-11 17:22:59 +02:00
Kaustubh Welankar 70c3514996 Removed Magic Numbers in propagator #5685 (#5705) 2017-04-20 11:14:53 +02:00
Christian Kamm 35af03b2e5 Improve http error messages; cleanup
By default QNetworkReply::errorString() often produces messages like
   "Error downloading <url> - server replied: <reason>"
but the "downloading" part invariably confuses people since the
error might very well have been produced by a PUT request.

This commit produces clearer error messages for HTTP errors.

Additionally:
* Remove some unnecessary null checks from slots connected to
  network job signals and document that these signals never send
  null replies.
* There was a bug where AbstractNetworkJob::_timedout wasn't
  set when derived classes overrode slotTimeout. We now ensure
  it's always set by disallowing overrides of slotTimeout.
  Instead it now calls onTimedOut, which allows custom handling.
* Several subclasses declared errorString, isTimedOut. Move
  these to AbstractNetworkJob.
* Unify handling of OC-ErrorString (via the new, general
  Job::errorString)
* Add documentation in various places.
2017-04-04 09:27:37 +02:00
Olivier Goffart d2bde5489f Propagator, remove the QNAM in the name as the alternative has been removed a long time ago 2016-08-31 10:25:06 +02:00
ckamm 25baa995ec Merge pull request #4532 from ckamm/content-checksum
Enable content checksums #4375
2016-03-14 09:49:31 +01:00
Markus Goetz 266508b691 Merge pull request #4529 from owncloud/dynamic_parallelism_scaling
Propagator: Pump in more requests if we think current ones are quick
2016-03-02 15:23:58 +01:00
Markus Goetz d78c3679e7 Propagator: Pump in more requests if we think current ones are quick
Helps with small file sync #331
When I benchmarked this, it went up to 6 parallelism and
was about 1/3 faster than the previous fixed 3 parallelism.
Doing more than 6 is dangerous because QNAM limits to 6 TCP
connections and also the server might become a bottleneck.

Should also help for #4081
2016-03-02 15:22:21 +01:00
Christian Kamm d6d3502960 Checksums: Compute content checksum on download #4375 2016-03-02 14:28:41 +01:00
Olivier Goffart e6f81d3965 Checksums: keep the transfer checksum in the database as the content checksum
Currently, we only use this for .eml files. But we can just store this checksum
in the database if it was computed anyway.

Issue #4487
2016-02-25 17:17:14 +01:00
Christian Kamm abf5a5ad1e Propagation: Fix dir <-> file changes propagating to server #4302
* Ensure every time a file becomes a directory or the other way around
  the item is flagged as INSTRUCTION_TYPE_CHANGE.
* Delete the badly-typed entity if necessary in the propagation jobs.
2016-01-08 05:38:08 +01:00
Christian Kamm a25f094c4c Checksums: Don't reupload if size and checksum are unchanged #3235
* Compute the content checksum (in addition to the optional
  transmission checksum) during upload (.eml files only)

* Add hook to compute and compare the checksum in csync_update

* Add content checksum to database, remove transmission checksum
2015-11-23 11:59:56 +01:00
Christian Kamm b7823dc648 Checksum: Put checksum type into separate column #3735 2015-10-28 14:46:20 +01:00
Christian Kamm b1387f801b Propagate: On download store checksum header in db #3735 2015-10-28 09:56:39 +01:00
Phil Davis f0e17fd9c0 libtypos comment and message typos for master 2015-10-05 09:05:09 +05:45
Christian Kamm 36e8e9ebf5 Propagator: Download disk space checks #2939
* There's a critical 50 MB threshold under which syncs abort
  (OWNCLOUD_CRITICAL_FREE_SPACE)
* The sync client always keeps 250 MB free
  (OWNCLOUD_FREE_SPACE)
2015-10-01 12:59:05 +02:00
Daniel Molkentin 66e8aaeabc Use doxygen style everywhere 2015-06-29 18:56:09 +02:00
Daniel Molkentin 0735aa1fbd Structure developer documentation
- rename target "doc-dev"
- group into modules
- move to doc/dev
2015-06-29 18:43:21 +02:00
Olivier Goffart 6b27d2e703 Merge remote-tracking branch 'origin/1.8' 2015-05-26 12:28:31 +02:00
Klaas Freitag dec3bd4a02 Some more minor cleanups based on the pull request review. 2015-05-20 22:44:12 +02:00
Klaas Freitag 5b5a636cc1 Make TransmissionChecksumValidator child of the job for auto delete.
That way no explicit memory management is needed as the allocation
is freed when the job (parent) is deleted automatically.
2015-05-20 16:54:04 +02:00
Klaas Freitag c7f759fedf Propagator: Use the TransmissionChecksumValidator class. 2015-05-19 17:09:40 +02:00