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

options for content.Writers; options to pre-provide input and output hashing, and blocksize #192

Merged
merged 1 commit into from
Nov 9, 2020

Conversation

deitch
Copy link
Contributor

@deitch deitch commented Oct 29, 2020

In most cases, e.g. a remote OCI registry store, you want to hash the retrieved object and validate it. But sometimes you don't, e.g. if you truly trust the store, or if the trade-off in hashing cost is too high. This gives you the option to skip hashing.

@deitch
Copy link
Contributor Author

deitch commented Oct 29, 2020

@jdolitsky as discussed. I have no idea why CI is failing, looks like some pulls from docker hub?

@deitch
Copy link
Contributor Author

deitch commented Nov 5, 2020

I restructured this to have the options be variadic functions, so the API is unchanged. Very similar to how https://godoc.org/github.com/containerd/containerd/content#WriterOpt works.

@deitch
Copy link
Contributor Author

deitch commented Nov 5, 2020

@jdolitsky I completely restructured this. I realized that the main reason to suppress hashes is likely because you already have them. Also, perhaps more importantly, you sometimes need those hashes for the underlying store, e.g. MemoryStore or FileStore.

So instead of an option to SkipHash, this has an option to provide the hash. If the hash is provided, it skips calculations. If you don't care what it is, provide the fixes BlankHash.

This also enabled me to set up some tests on it.

@deitch deitch changed the title option to skip hashing options for content.Writers; options to pre-provide input and output hashing Nov 5, 2020
pkg/content/gunzip.go Outdated Show resolved Hide resolved
…put hashes

Signed-off-by: Avi Deitcher <avi@deitcher.net>
@deitch deitch changed the title options for content.Writers; options to pre-provide input and output hashing options for content.Writers; options to pre-provide input and output hashing, and blocksize Nov 9, 2020
@deitch
Copy link
Contributor Author

deitch commented Nov 9, 2020

Done. Back at you @jdolitsky

Copy link
Contributor

@jdolitsky jdolitsky left a comment

Choose a reason for hiding this comment

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

👍

@jdolitsky jdolitsky merged commit 2ca9464 into oras-project:master Nov 9, 2020
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.

2 participants