2020-05-28 20:46:33 +00:00
|
|
|
package cache
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/containerd/containerd/content"
|
2020-10-27 06:13:39 +00:00
|
|
|
"github.com/moby/buildkit/session"
|
2020-05-28 20:46:33 +00:00
|
|
|
"github.com/moby/buildkit/util/progress"
|
|
|
|
digest "github.com/opencontainers/go-digest"
|
|
|
|
)
|
|
|
|
|
|
|
|
type DescHandler struct {
|
2020-10-27 06:13:39 +00:00
|
|
|
Provider func(session.Group) content.Provider
|
2020-08-17 09:34:33 +00:00
|
|
|
Progress progress.Controller
|
|
|
|
SnapshotLabels map[string]string
|
2021-07-26 02:00:48 +00:00
|
|
|
Annotations map[string]string
|
2021-07-13 05:28:35 +00:00
|
|
|
Ref string // string representation of desc origin, can be used as a sync key
|
2020-05-28 20:46:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type DescHandlers map[digest.Digest]*DescHandler
|
|
|
|
|
|
|
|
func descHandlersOf(opts ...RefOption) DescHandlers {
|
|
|
|
for _, opt := range opts {
|
|
|
|
if opt, ok := opt.(DescHandlers); ok {
|
|
|
|
return opt
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type DescHandlerKey digest.Digest
|
|
|
|
|
|
|
|
type NeedsRemoteProvidersError []digest.Digest
|
|
|
|
|
|
|
|
func (m NeedsRemoteProvidersError) Error() string {
|
|
|
|
return fmt.Sprintf("missing descriptor handlers for lazy blobs %+v", []digest.Digest(m))
|
|
|
|
}
|