-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎁 Adding DerivativeRodeoService#cleanup_derivatives ♻️
Apologies in advance, this commit conflates two things, but I'll explain. This commit is in service of completing the DerivativeService interface; namely the `#cleanup_derivatives` method. Originally, I was thinking I would only delete the derivatives generated by this service. So I began refactoring to reduce knowledge. That refactor meant extracting `#named_derivatives_and_generators`, and as a matter of hygiene and legibility, I moved the method closer to the configuration. The hope being that if one thing changes the other might. This then involved rethinking the `#create_derivatives` and `#cleanup_derivatives` to use this new method. I was looking for symmetry in method implementation (e.g. loop over the named derivatives and either create them or delete them). However, as I looked at the other reference implementations I noticed that I could get all of the derivatives by calling `Hyrax::DerivativePath.derivatives_for_reference` ([see code][1]). I spent a bit of time thinking, as the comments indicate, as to which approach to take: delete all derivatives OR only those that would be created by the present configuration. It makes sense to me to delete all of them, in part due to the implementation details of finding the correct `valid?` derivative service but also the fact that any `valid?` service is subject to configuration, which might change over time, and thus leave orphaned derivatives dangling in the file system. Closes #270 Related to: - notch8/derivative_rodeo#56 [1]:https://github.com/samvera/hyrax/blob/b28d8ff35d2fb708483d2ce0c4e687450b7f5aef/app/services/hyrax/derivative_path.rb#L14-L18
- Loading branch information
Showing
1 changed file
with
83 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters