Skip to content
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

Write payload manifest checksums to tag manifests #15

Merged
merged 14 commits into from
Apr 20, 2020

Conversation

mikejritter
Copy link
Contributor

Resolves: #10

This updates the BagWriter to write the checksums for payload manifests to each of the tag manifests.

The biggest change for this is that it updates the logic for creating the checksums - instead of having many MessageDigest instances in the BagWriter, the OutputStream for a file is wrapped using DigestOutputStreams. These pass the contents being written to the OutputStream which they were created with, so they do not impact the writing of the file itself or interfere with any other digests. This is handled by the streamFor method and an addition field activeStreams which keeps track of the ongoing checksums.

This updates how checksums are calculated, moving away from a more inlined version
of instantiating and updating MessageDigests to wrapping each available algorithm
in a DigestOutputStream.
@codecov-io
Copy link

Codecov Report

Merging #15 into master will increase coverage by 1.79%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #15      +/-   ##
============================================
+ Coverage     85.61%   87.41%   +1.79%     
- Complexity      136      141       +5     
============================================
  Files            16       16              
  Lines           577      572       -5     
  Branches         86       82       -4     
============================================
+ Hits            494      500       +6     
+ Misses           45       42       -3     
+ Partials         38       30       -8
Impacted Files Coverage Δ Complexity Δ
src/main/java/org/duraspace/bagit/BagWriter.java 92.2% <100%> (+12.93%) 19 <4> (+5) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7047e0a...bf40662. Read the comment docs.

@bbranan bbranan requested a review from dbernstein March 30, 2020 16:29
Copy link
Member

@awoods awoods left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

The only comments I have (which are inspired by, but not related to this PR) are that we should probably test:

  1. On Windows (paths and input/output streams are not allows cross-platform compatible), fcrepo travis example
  2. Add one or more tests that include UTF-8 characters.

@mikejritter
Copy link
Contributor Author

@awoods I added a Windows job to Travis for this PR since it doesn't have a large impact. It took a bit more fiddling than I expected (didn't initially read that java isn't officially supported on Windows, learning things about travis and chocolatey), but both builds are now passing.

For adding were you referring to a file with UTF-8 characters in it, or UTF-8 in the filename? Regardless I'm thinking it would be best to pull that up into its own issue so that we can add tests for some of the other classes as well.

@bbranan bbranan merged commit 92632ab into duraspace:master Apr 20, 2020
@bbranan
Copy link
Member

bbranan commented Apr 20, 2020

Created new issue to capture @awoods' suggestion to include tests with UTF-8 support: #24

@mikejritter mikejritter deleted the 10-payload-manifest branch August 19, 2020 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add payload manifest to the tag manifests
4 participants