Move label-related logic into a separated package #163
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.
Previous: #161
Related: moby/buildkit#1733
This commit separates labels-related logic from the filesystem core. This introduces a new package
source
(github.com/containerd/stargz-snapshotter/stargz/source
) and defines a logic to convert snapshot labels into blob sources informationsource.Source
.source
package defines an interface of that converter (GetSources
) , and contains the default implementation based oncontainerd.io/snapshot/remote/stargz...
labels (which is previously embedded in the filesystem core).Now the filesystem uses
source.GetSources
for acquiring blob source information. By default, it uses the implementation bysource
package but it accepts any user-defined ones through a constructor optionWithGetSources
.containerd-stargz-grpc
uses the followingsource.GetSources
implementations.containerd.io/snapshot/remote/stargz...
(implemented insource
package).containerd.io/snapshot/cri...
passed from CRI, which previously embedded in the filesystem core.Another note comes with this change is that the filesystem is now agnostic about (source-related) labels.
source.GetSources
implementations aren't required to use these labels so they can provide blob source information leveraging other media instead of these labels (e.g. using manifest-like JSON data + content store).