feat(versioner): add 'Archive Deleted Only' option to trashcan versioner (fixes #6164)#10111
feat(versioner): add 'Archive Deleted Only' option to trashcan versioner (fixes #6164)#10111tejas-rkd wants to merge 3 commits intosyncthing:mainfrom
Conversation
|
Thank you for working on this! I will personally find this very useful, e.g. when dealing with virtual disk images that are huge in size and change often, making the current versioning approach not feasible and forcing to disable file versioning for the whole folder. Just a comment, as I haven't tested the code at all yet. I don't think we actually use the word "archive" in the GUI when talking about versioning. I understand that it is present in the code, but in the GUI, we just talk about "Versions Path" and "versions being stored" there (i.e. not "archived"). Wouldn't it be better and more understandable if we stick to the current wording? Basically, what I want to say that "archive" is a vague term, which can mean different things depending on the context. Also, are you planning to enable this by default? If not, then I think it should be just |
There was a problem hiding this comment.
I've quickly glanced over the code changes and in general, the feature seems sensible. The extra interface for checking whether the versioner supports the flag seems a little specific and could possibly be integrated more elegantly / with broader scope. Though I can't give you a counter-proposal now, would need to invest more time understanding the relevant bits first. So let's hear an opinion on that from the other maintainers.
The change to the man page is however definitely out of place, because it is generated from the docs repo and should be adjusted there.
Glad that this change is helpful to you!
I have made changes to UI code. Do you think we need similar renaming across backend changes?
Going through #6164 discussion, I don't see a clear majority for any behavior. Let's use this PR to invigorate the dead discussion 🙈 |
Thank you for the review. My motivation behind this was to avoid modifying the core
Removed man changes as they are tracked via syncthing/docs#930 |
| "Anonymous usage report format has changed. Would you like to move to the new format?": "Anonymous usage report format has changed. Would you like to move to the new format?", | ||
| "Applied to LAN": "Applied to LAN", | ||
| "Apply": "Apply", | ||
| "Version Deleted Only":"Version Deleted Only", |
There was a problem hiding this comment.
Did you insert this string manually? Because it sure looks like having a different white-space pattern.
The correct way to update this file is this:
go run build.go translate
Possibly after first emptying the file (just {} as content), in case you removed strings.
|
Sorry for the late feedback, but the word "archive" is used several times in |
|
I've now looked a bit more closely at the PR. @rasa is right about the word "archive" already used in the Docs, I think it could also be used here, just make the wording more clear and easily understandable to the user. I'll try suggesting some fixes directly in the code in this regard.
Is there any difficulty with applying this universally to all versioning types (except external, of course)? Simple and staggered versioning would greatly benefit from the feature as well.
On the one hand, there are different opinions, but on the other, the issue was created by @calmh himself and requests "enabling by default" right in the title, so I think to actually "fix" the issue, the option does need to come enabled. Otherwise you can just |
| <div class="checkbox"> | ||
| <label for="versioning-trashcan-archiveDeletedOnly-{{currentFolder.id}}"> | ||
| <input type="checkbox" id="versioning-trashcan-archiveDeletedOnly-{{currentFolder.id}}" ng-model="currentFolder._guiVersioning.archiveDeletedOnly"> | ||
| <span translate>Version Deleted Only</span> |
There was a problem hiding this comment.
| <span translate>Version Deleted Only</span> | |
| <span translate>Archive Deleted Files Only</span> |
| <span translate>Version Deleted Only</span> | ||
| </label> | ||
| </div> | ||
| <p class="help-block"><small translate>If selected, only deleted files will be moved to the version folder. Modified files will not be versioned.</small></p> |
There was a problem hiding this comment.
| <p class="help-block"><small translate>If selected, only deleted files will be moved to the version folder. Modified files will not be versioned.</small></p> | |
| <p class="help-block" translate>If selected, only deleted files will be moved to the versions directory. Modified files will not be archived.</p> |
"Versions directory" is already used in the explanation under "Cleanup Interval". I also think that the text should be normal size (as is the case with other explanatory remarks in the GUI).
| <span ng-switch-when="external" tooltip data-original-title="{{folder.versioning.params.command}}" translate>External</span> | ||
| </span> | ||
| <span ng-if="folder.versioning.type != 'external'"> | ||
| <span ng-if="(folder.versioning.type == 'trashcan') && (folder.versioning.params.archiveDeletedOnly === 'true')" tooltip data-original-title="{{'Version Deleted Only' | translate}}"> |
There was a problem hiding this comment.
| <span ng-if="(folder.versioning.type == 'trashcan') && (folder.versioning.params.archiveDeletedOnly === 'true')" tooltip data-original-title="{{'Version Deleted Only' | translate}}"> | |
| <span ng-if="(folder.versioning.type == 'trashcan') && (folder.versioning.params.archiveDeletedOnly === 'true')" tooltip data-original-title="{{'Version Deleted Files Only' | translate}}"> |
| </span> | ||
| <span ng-if="folder.versioning.type != 'external'"> | ||
| <span ng-if="(folder.versioning.type == 'trashcan') && (folder.versioning.params.archiveDeletedOnly === 'true')" tooltip data-original-title="{{'Version Deleted Only' | translate}}"> | ||
|  <span class="fa fa-archive"></span> <span ng-if="folder.versioning.params.archiveDeletedOnly" translate>Deleted Only</span> |
There was a problem hiding this comment.
|  <span class="fa fa-archive"></span> <span ng-if="folder.versioning.params.archiveDeletedOnly" translate>Deleted Only</span> | |
|  <span class="fa fa-ban"></span> <span ng-if="folder.versioning.params.archiveDeletedOnly" translate>Deleted</span> |
I've tried to shorten this to just "Delete" with a different icon (suggesting that deleted files are not versioned). Ignore the previous sentence, I got things mixed up, obviously the icon should suggest that only deleted files are kept 😅.
The problem is that the current Deleted Only string is too long, possibly pushing versions path outside of the folder information (as can be seen in your own screenshot). Please feel free to experiment with different ideas if you think this isn't the best solution, but the point is to make this a single word (or maybe even just an icon with a tooltip?).
Purpose
The current trash can versioning system creates a backup of files both when they are deleted and when they are modified. For many users, the primary concern is protecting against accidental deletions, not needing a full history of file changes. A more lightweight option that only versions deleted files, would address the most painful data loss scenarios while using significantly less disk space than full versioning. (fixes #6164)
Solution
Add a new "Archive Deleted Only" option to the Trash Can versioning system. When enabled, this option makes the versioner only archive files that are deleted, skipping versioning for modifications. This provides protection against the most common data loss scenarios without filling up storage with versions of every modified file.
This is implemented through a new interface
ArchiverForDeletedOnlywhich exposes anArchiveDeletedOnly()method to check this configuration. The folder-sync code has been updated to check this setting and skip archiving for file modifications when enabled.Testing
Screenshots
Documentation
syncthing/docs#930
These changes are subjected to change in this pull request.
Authorship
Your name and email will be added automatically to the AUTHORS file
based on the commit metadata.