Skip to content

Conversation

giuseppe
Copy link
Member

add support for the estargz compression format from
https://github.com/containerd/stargz-snapshotter

Signed-off-by: Giuseppe Scrivano gscrivan@redhat.com

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

How large is the added dependency?

Through some lack of foresight and carelessness, we have ended up with various components that really shouldn’t care, like c/image/docker, depending on this subpackage.

At some point, we need to resolve that, either by a significant reimplementation of those dependency chains, or by making the new compression formats optional.

In this case at least, where we don’t need any new implementation to decompress the data, and where compression using this format can only ever happen by an explicit user request (i.e. types.SystemContext.CompressionFormat providing a *compressiontypes.Algorithm), it might make sense to move this into a subpackage. And then, to allow simple implementations of CLIs, we might need a transports/alltransports-like split of the algorithm registry and the algorithm dependencies.

@@ -35,13 +37,17 @@ var (
// Zstd:chunked compression.
ZstdChunked = internal.NewAlgorithm(types.ZstdChunkedAlgorithmName, types.ZstdAlgorithmName, /* Note: InternalUnstableUndocumentedMIMEQuestionMark is not ZstdChunkedAlgorithmName */
nil, ZstdDecompressor, compressor.ZstdCompressor)
// Estargz compression.
Estargz = internal.NewAlgorithm(types.EstargzChunkedAlgorithmName, types.GzipAlgorithmName, /* Note: InternalUnstableUndocumentedMIMEQuestionMark is not ZstdChunkedAlgorithmName */
Copy link
Collaborator

Choose a reason for hiding this comment

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

The comment is wrong.

(Also, please actually define and document the semantics of that field?)

@giuseppe
Copy link
Member Author

@ktock do you think we can move some of the logic to github.com/containerd/stargz-snapshotter?

@ktock
Copy link
Contributor

ktock commented Aug 20, 2021

@giuseppe I think we can move estarCompressor to github.com/containerd/stargz-snapshotter/estargz . Could you open up the PR?

defer blob.Close()

c.metadata["containerd.io/snapshot/stargz/toc.digest"] = string(blob.TOCDigest())
c.metadata["io.containers.estargz.uncompressed-size"] = fmt.Sprintf("%v", st.Size())
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be the uncompressed size of the result estargz blob (not the source tar).

return nil, err
}
// Unlink immediately the file so we won't leak it.
os.Remove(file.Name())
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we return err here?

add support for the estargz compression format from
https://github.com/containerd/stargz-snapshotter

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@giuseppe
Copy link
Member Author

I've moved the implementation to containers/storage: containers/storage#1001

// streams as it would have been done with 206.
streams := make(chan io.ReadCloser)
errs := make(chan error)
go func() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is becoming rather large (e.g. how far down the “unknown res.StatusCode case is); please split the two streams-producing goroutines into two separate functions.

Unit tests also look worthwhile, at least for those streams producers; without testing actual pulls of this format with high frequency (the way Skopeo and Podman tests trigger at least the default pull paths), we are pretty unlikely to notice breakage.

@giuseppe giuseppe force-pushed the estargz-support branch 2 times, most recently from a65c7b4 to 9c77027 Compare August 25, 2021 07:18
@giuseppe
Copy link
Member Author

@mtrmac moved a patch to a different PR: #1359

@giuseppe giuseppe closed this Sep 21, 2021
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