[backup] Revoke holders on upload error
Summary:
Part of ENG-4501
If upload fails at some point we want to revoke holders for blobs so they don't hang around forever. For this purpose I've added a general purpose Defer struct that will defer a given command until an end of scope. If everything succeeds we cancel them (=> don't revoke the holders for blobs).
Depends on D8966
Test Plan:
cargo run -- --localstack-endpoint 'dummy url'
Check in logs if there was a blob upload (for both user keys and data). Check in db if there are no blob or backup rows present after the request ended.
Run service normally, check if upload still works.
Reviewers: bartek, patryk, kamil, jon
Reviewed By: bartek
Subscribers: ashoat, tomek
Differential Revision: https://phab.comm.dev/D8967