-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to configure "Keep only the last version of the file" lifecycle rule without magic #85
Comments
I'm not sure what "Keep only the last version of the file" in the UI translates to on the backend - if you set that and dump the current settings using b2 cli, you might find out how to set it up so that the UI displays it the same way, |
You get this, which is what @colans posted above:
The key concepts here are:
Most tools that work with versioned buckets default to soft deletes, since you can undelete the files later. The lifecycle rules allow you to say "hard delete hidden files after so many days". With the B2 Native API, you call b2_hide_file; with the S3-compatible API, you call DeleteObject without the Many tools allow you to also perform hard deletes. In this case, the file is immediately deleted, with no way to restore it later. With the B2 Native API, you call b2_delete_file_version; with the S3-compatible API, you call DeleteObject with the Now, if you always use hard deletes, lifecycle rules are irrelevant. There are never any hidden files to deal with. If you use soft deletes, you can use lifecycle rules to configure how long hidden files are retained before they are hard deleted. The reason that the minimum period for The doc page on File Versions has a more detailed explanation, if you're interested.
Since there is no way to immediately delete a file after it is hidden, you might want to look at whether you should hard delete files. If you are using an off-the-shelf product that cannot be configured to hard delete files, you could look at using Event Notifications to achieve your goal. You could configure an event notification rule to send you a notification on the Answering your list of questions:
Hopefully this explains the magic. Feel free to post any more questions here, or close the issue, as you see fit. |
Thanks for the background! Certainly sheds some insight.
That's strange, because again, that's what came back from However, I am using hard deletes, as that's what's best for Restic repositories. But I was hoping to do it both ways, just in case. |
You're most welcome!
I think it is. I think that terraform import should either not include @mlech-reef / @emnoor-reef - should I change the title of this issue to something like "terraform import should not set |
@metadaddy please create a new issue. I will take a look later this week. |
I'm trying to set this up like in the Web UI:
It seems like these settings are the most appropriate:
However, when I look at the Web front-end, I it's set to custom lifecycle rules, which is different:
So I tried setting it manually, deleting it from my state, and then importing to see what the correct settings would be:
But then when I try to
apply
that, I get:So then I tried this:
This seems to work, as in it shows up correctly in the Web UI, but how does hiding the file for one day actually mean that files shouldn't be kept? This seems like some sort of secret magic incantation that shouldn't work, while it doesn't work the way it should. Said another way, it's extremely counter-intuitive.
Questions:
There's another issue about this at #46, but that's just a documentation issue requiring setting
file_name_prefix = ""
.The text was updated successfully, but these errors were encountered: