Remove Blob conversion from ImageToTarballTranslator and TarStreamBuilder #1647
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.
I am going to do a serious of refactoring to our repo (not about our API visibility but about making our codebase healthy), and this is the first step. I have many more PRs to come.
When I first came to the repo,
Blob
was a very confusing class. As much as the name says, it is a very general class and can wrap up any object, anything that holds any information, or anything that may potentially be written to somewhere. It often disguises the actual object to the point of not being able to get what it really is. To me, oftenBlob
looks like the JavaObject
class.Another problem is the abuse of
Blob
to write something toOutputStream
. WithBlob
havingtoWrite(OutputStream)
, examples of prevalent abuse in our codebase areBlob
blindly for the sake of writing toOutputStream
.Blob
blindly to compute a digest of a content. (Blob.writeTo()
returns a digest.)Currently,
ImageToTarballTranslator
(which effectively represents a tarball for anImage
) is doing a convoluted way of writing it to a file or a Docker daemon:ImageToTarballTranslator
-->Blob
--> write to an output streamIn this PR, I'm making this straightforward and intuitive by
ImageToTarballTranslator
write to an output stream; andBlob
fromImageToTarballTranslator
.Also,
DockerClient.load()
acceptingBlob
seems is too general and obscure, which doesn't look very different fromload(Object anything)
.