...
- Create a staging OCFL repository for constructing squashed objects
- Create the object in the staging repository
- Copy over each version of the original object into the staged object up until the beginning of the squash by replaying the changes that were made in each version
- Diff the squashed changes. For example, if you're squashing versions v4 through v8, then you'd create a diff between v3 and v8. This diff represents the changes that should be applied to the object to create the squashed v4
- Create the squashed version by applying the diff
- Proceed to copy over any remaining versions in the same manner as in step 3
- Validate the newly formed object
- Purge the original object
- Import the staged object
- Reindex
Notes
The only feature to support this that ocfl-java is currently missing is the ability to generate a diff between versions, but this would not be hard to add.The advantage to doing it in a separate repository is that you can use the same object id and do not need to rewrite the inventories later.