I'm looking for a way to run some code at the end of the backend's lifecycle. I've read the discussion at The end of use of a backend . Was going to use lib/atexit , but stumbled upon the Shutdowner interface, which seems to be a much cleaner way to solve my task. Unfortunately, my backend's Shutdown() function do not being called. Related code:
I'm working on the backend, which allows storing files directly in Tar archives. I need to write an archive footer (2x zero blocks) after the sync or copy session ends.
PS:
Also, I've noticed some other methods in my backend are not being called at all:
I wrote a similar backend (unreleased) which writes into zip files. For that I used libatexit.
The backend life-cycle isn't fixed yet.
What it would be nice to happen is that the Shutdown method gets called whenever a backend is no longer used, so at the end of the program or when a backend is removed from the backend cache...
I made an issue about this
Those should be called definitely depending on exactly what you are doing.