Skip to content

Commit a2aa4ec

Browse files
Merge pull request containerd#1485 from AkihiroSuda/expose-differ
differ: expose newWalkingDiff() for standalone buildkit
2 parents 313cebc + 1310c85 commit a2aa4ec

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

differ/differ.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func init() {
3838
if err != nil {
3939
return nil, err
4040
}
41-
return newWalkingDiff(metadata.NewContentStore(md.(*bolt.DB), c.(content.Store)))
41+
return NewWalkingDiff(metadata.NewContentStore(md.(*bolt.DB), c.(content.Store)))
4242
},
4343
})
4444
}
@@ -49,12 +49,17 @@ type walkingDiff struct {
4949

5050
var emptyDesc = ocispec.Descriptor{}
5151

52-
func newWalkingDiff(store content.Store) (plugin.Differ, error) {
52+
// NewWalkingDiff is a generic implementation of plugin.Differ.
53+
// NewWalkingDiff is expected to work with any filesystem.
54+
func NewWalkingDiff(store content.Store) (plugin.Differ, error) {
5355
return &walkingDiff{
5456
store: store,
5557
}, nil
5658
}
5759

60+
// Apply applies the content associated with the provided digests onto the
61+
// provided mounts. Archive content will be extracted and decompressed if
62+
// necessary.
5863
func (s *walkingDiff) Apply(ctx context.Context, desc ocispec.Descriptor, mounts []mount.Mount) (ocispec.Descriptor, error) {
5964
var isCompressed bool
6065
switch desc.MediaType {
@@ -118,6 +123,8 @@ func (s *walkingDiff) Apply(ctx context.Context, desc ocispec.Descriptor, mounts
118123
}, nil
119124
}
120125

126+
// DiffMounts creates a diff between the given mounts and uploads the result
127+
// to the content store.
121128
func (s *walkingDiff) DiffMounts(ctx context.Context, lower, upper []mount.Mount, media, ref string) (ocispec.Descriptor, error) {
122129
var isCompressed bool
123130
switch media {

0 commit comments

Comments
 (0)