Add convenience methods for payload management#209
Open
cgaudin wants to merge 8 commits into
Open
Conversation
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
This PR adds a small set of convenience methods for common payload management operations.
Currently, modifying a Bag payload typically requires manually copying or removing files inside the
datadirectory and then calling:The new helper methods provide a higher-level API for these common operations while reusing the existing manifest generation and validation logic.
Added APIs
Bag.update_payload()Convenience wrapper around:
to rebuild payload manifests, tag manifests and update
Payload-Oxum.Bag.payload_oxum()Returns the current payload size and file count as a tuple:
Bag.add_payload()Adds files or directories to the payload and updates manifests.
Examples:
Bag.remove_payload()Removes payload files or directories and updates manifests.
Examples:
Motivation
These helpers simplify common Bag modification workflows and reduce the amount of boilerplate required when applications need to add, remove, or replace payload content programmatically.
All functionality is implemented on top of the existing BagIt logic and existing tests continue to pass.
Testing
New unit tests have been added for: