Add progress

Signed-off-by: Derek McGowan <derek@mcg.dev>

Update progress to reference parents

Signed-off-by: Derek McGowan <derek@mcg.dev>

Update Progress logic

Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
Derek McGowan
2022-07-19 13:14:37 -07:00
parent 0e4e96544f
commit 81afd9c36e
6 changed files with 478 additions and 55 deletions

View File

@@ -44,6 +44,8 @@ type ImageFilterer interface {
ImageFilter(images.HandlerFunc) images.HandlerFunc
}
// ImageStorer is a type which is capable of storing an image to
// for a provided descriptor
type ImageStorer interface {
Store(context.Context, ocispec.Descriptor) (images.Image, error)
}
@@ -53,21 +55,27 @@ type ImageUnpacker interface {
UnpackPlatforms() []unpack.Platform
}
type ProgressFunc func(Progress)
type TransferOpts struct {
Progress ProgressFunc
}
type Opt func(*TransferOpts)
func WithProgress() Opt {
return nil
func WithProgress(f ProgressFunc) Opt {
return func(opts *TransferOpts) {
opts.Progress = f
}
}
type Progress struct {
Event string
Name string
Digest string
Parents []string
Progress int64
Total int64
// Descriptor?
}
/*