Commit Graph
20 Commits
Author SHA1 Message Date
Kenneth Skovhede 0f81b42146 Add support for remote locks
This PR adds support for locking files if the backend supports it.

To activate locking, set the option `--file-lock-duration=30D` and the backup will lock the files.

If the database is rebuilt with the intention of continuing the backups, use the option `--repair-refresh-lock-info` which will update lock information in the database after recreating the database.

The locking works by asking the backend to lock files after a backup has completed.

The implementation keeps track of which files are currently assigned a lock and prevents attempting to delete the files that are currently locked.

Note that the bucket should not have a default lock policy as Duplicati needs to finish the backup before the locking is applied.

In this initial version, Azure Blob Storage, B2, S3 and iDrive are supported with locking.

The CLI is updated to allow setting locks on a specific version. The backend tool is updated to allow setting locks on specific files.
2025-12-14 17:17:48 +01:00
Carl Johnsen 6ee76a29d3 Made the callback on a put command to the backend be a function returning an awaitable Task rather than an Action. 2025-06-23 10:27:09 +02:00
Carl Johnsen 31c5441bdb Forwarded cancellation tokens, added some missing .ConfigureAwait() and added some missing docstrings 2025-06-19 11:04:09 +02:00
Carl Johnsen e81100de04 Started on adding docstrings 2025-06-17 09:59:22 +02:00
Carl Johnsen 3d11a05400 Added .ConfigureAwait(false) to all of the await statements 2025-06-12 08:34:29 +02:00
Carl Johnsen ee40767412 Merge branch 'master' into performance/mssqlite-async 2025-05-27 12:04:50 +02:00
Carl Johnsen 46f394d6d5 Updated the BackendManager implementation to not pass down transactions (as they should be implicitly handled by the databases) and to use the new async database methods 2025-05-22 08:07:23 +02:00
Kenneth Skovhede a4234a342c Default disable throttle for local destinations
This PR adds the option to disable throttle on a backup, so it will ignore throttle settings both from the server and the job.

Additionally, a list of backend keys can be provided, where backups will disable throttling. This can be used to set advanced options with a set of backends that should not be throttled.

By default, the `file` backend is now exempt from throttling by default.
This fixes #2685
2025-05-20 19:06:35 +02:00
Kenneth Skovhede f88635717d Merge remote-tracking branch 'origin/master' into feature/fix-throttle-speeds 2025-04-24 21:49:11 +02:00
Kenneth Skovhede 3ff868b0f9 Removed tracking of files sizes, and implemented it with a database lookup 2025-04-23 15:39:32 +02:00
Kenneth Skovhede 66862043b6 Fixed a case where the transactions were not used, despite being active 2025-04-23 13:44:46 +02:00
Kenneth Skovhede e6ba6098d7 Implemented immediate transaction commits for almost all uploads.
This ensures that files cannot appear on the remote destination, despite terminating the host program.

This fixes #4485

There is still work needed to handle the repair and compact operations so they use transactions and can commit changes during transfer progress.
2025-04-23 12:11:16 +02:00
Kenneth Skovhede f393c00030 Fixed throttle support
This moves the throttle support to the StreamUtil throttled stream, which allows multiple streams to share a throttle value, such that the throttle setting is applied to the entire communication from Duplicati, and not for each connection.

This also cleans up a bit in the progress reporting, where the backend manager now keeps track of the "active" transfer and only emits progress on that. Once it finishes, a new transfer is promoted a "active".
2025-04-22 22:54:48 +02:00
Marcelo C. d528ef6278 Fix Resource Leak in BackendManager Connection Handling
While investigating issue [#6103](https://github.com/duplicati/duplicati/issues/6103), found that connections were not disposed due to the backend pool in BackendManager's handler. Set up a FileZilla server to test the issue before and after the change, confirming that connections now close as expected with this fix.
2025-04-08 11:24:14 -03:00
Kenneth Skovhede 1321488527 Improve failure detection
This commit adds extra logic to prevent cases where the backup reports success but leaves behind partial files.

A new flag is recorded to track if partial files are possible. If no partial files are possible, the verification will fail if any are found.
2025-03-06 12:02:11 +01:00
Carl Johnsen beefbf2a46 Removed some unused variables from the BackendManager 2025-02-19 16:12:58 +01:00
Carl Johnsen 374741fc6d Added BackendManager.GetDirectAsync(), which downloads a file without decrypting it 2025-02-19 16:11:55 +01:00
Carl Johnsen 2c06820281 Made the BackendManager.GetOperations' decryption methods static and public so the restores VolumeDecryptor can use the same code. 2025-02-19 16:09:32 +01:00
Carl Johnsen 9f3f15615d Exposed spawning multiple backends from the BackendManager 2025-02-18 09:10:13 +01:00
Kenneth SkovhedeandGitHub d99f74ed94 Rewrite the backend manager. (#5896)
* Rewrite the backend manager.

This creates a new more logic backend manager that handles all backend operations.

For each top-level operation, there is now a single backend manager instance that is passed to sub-commands.

The internals of the backend manager are now rewritten to use async logic instead of threading.

The design uses a single task runner that dispatches operations and honors concurrent settings and limits from one place.

The logic for each operation has been moved into a separate files/classes to make it easier to understand each operation.

This fixes #5804

* Fixed a few issues with not awaiting tasks

* Fixed not creating empty databases

* Fixed an issue with hashes not being recorded on download

* Reworked the download logic to avoid attempting to decrypt the file if it has been modified.

* Review fixes

* Renamed db collector to better reflect the purpose.

* Review fixes
2025-01-28 08:54:50 +01:00