-
Notifications
You must be signed in to change notification settings - Fork 10
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
refactor: improve compaction logic #373
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #373 +/- ##
==========================================
+ Coverage 62.59% 62.64% +0.05%
==========================================
Files 37 37
Lines 3240 3234 -6
==========================================
- Hits 2028 2026 -2
+ Misses 1046 1043 -3
+ Partials 166 165 -1 ☔ View full report in Codecov by Sentry. |
Previously, an add operation would simply append the data object to the end of the data section. If one or more object(s) had previously been deleted from the image, this could result in wasted space. Now, we trim the data section based on in-use objects before adding the new object. Update tests to reflect this new behaviour.
Improve compaction via OptDeleteCompact. Do not fail when compaction is requested on a data object that is not at the end of the data section. When compaction is requested, always calculate the end of the data section based on the in-use descriptors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a result of this line: Those two test cases delete the last object in the SIF without supplying the compact option, and then add a new object. Previously, the code would append after the end of the data section (which still included the deleted object.) The new code calculates where the end of the valid data actually is, and appends there. |
Thanks... apologies I missed that! |
Improve the behaviour of image compaction when adding/deleting data objects.
Improve compaction when
OptDeleteCompact
is supplied toDeleteObject
. Do not fail when compaction is requested on a data object that is not at the end of the data section. When compaction is requested, always calculate the end of the data section based on the in-use descriptors.Previously,
AddObject
would simply append the data object to the end of the data section. If one or more object(s) had previously been deleted from the image, this could result in wasted space. Now, we trim the data section based on in-use objects before adding the new object.Add/update tests to reflect new behaviour.
Closes #193