8000 Add Tarsum Calculation during v2 Pull operation by jlhawn · Pull Request #9 · dmcgowan/docker · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add Tarsum Calculation during v2 Pull operation #9

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

Merged
merged 1 commit into from
Dec 23, 2014

Conversation

jlhawn
Copy link
@jlhawn jlhawn commented Dec 23, 2014

While the v2 pull operation is writing the body of the layer blob to disk
it now computes the tarsum checksum of the archive before extracting it to
the backend storage driver. If the checksum does not match that from the
image manifest an error is raised.

Also adds more debug logging to the pull operation and fixes existing test
cases which were failing.

Docker-DCO-1.1-Signed-off-by: Josh Hawn josh.hawn@docker.com (github: jlhawn)

While the v2 pull operation is writing the body of the layer blob to disk
it now computes the tarsum checksum of the archive before extracting it to
the backend storage driver. If the checksum does not match that from the
image manifest an error is raised.

Also adds more debug logging to the pull operation and fixes existing test
cases which were failing.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
@jlhawn
Copy link
Author
jlhawn commented Dec 23, 2014

It passes the tests! I checked.

@dmp42
Copy link
dmp42 commented Dec 23, 2014

// Create a new TarSum using the provided TarSum version+hash label.
func NewTarSumForLabel(r io.Reader, disableCompression bool, label string) (TarSum, error) {
parts := strings.SplitN(label, "+", 2)
if len(parts) != 2 {

Choose a reason for hiding this comment

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

doesn't splitN force it to be 2

Choose a reason for hiding this comment

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

nm I was wrong https://play.golang.org/p/JhWAqEM7Al if curious

Copy link
Author

Choose a reason for hiding this comment

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

er, I think it's at most 2, per the docs:

n > 0: at most n substrings; the last substring will be the unsplit remainder.

@jessfraz
Copy link

lgtm

@@ -39,6 +42,30 @@ func NewTarSumHash(r io.Reader, dc bool, v Version, tHash THash) (TarSum, error)
return ts, err
}

// Create a new TarSum using the provided TarSum version+hash label.
func NewTarSumForLabel(r io.Reader, disableCompression bool, label string) (TarSum, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not sure I am into this being a single function. I don't have a better suggestion at this time, so you can disregard my comment.

Copy link
Author

Choose a reason for hiding this comment

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

I just added this to the tarsum package because there currently isn't a reverse lookup constructor >_>

@stevvooe
Copy link
Collaborator

LGTM!

@dmp42
Copy link
dmp42 commented Dec 23, 2014

LGTM

@dmp42 dmp42 merged this pull request into dmcgowan:v2-registry Dec 23, 2014
@jlhawn jlhawn deleted the v2-registry branch July 31, 2015 18:04
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.

4 participants
0