Documentation
¶
Overview ¶
Package download provides an API for resource download handlers. A download handler is used for downloading resoures. By default the native blob as provided by the access method is the resukt of a download. A download handler can influence the outbound blob format according to the concrete type of the resource. For example, a helm download for a helm artifact stored as oci artifact will not provide the oci format chosen for representing the artifact in OCI but a regular helm archive according to its specification. The sub package handlers provides dedicated packages for standard handlers.
A downloader registry is stores as attribute ATTR_DOWNLOADER_HANDLERS for the OCM context, it is not a static part of the OCM context. The downloaders are basically used by clients requiring access to the effective resource content.
Index ¶
Constants ¶
const ALL = "*"
const ATTR_DOWNLOADER_HANDLERS = "github.com/open-component-model/ocm/pkg/contexts/ocm/download"
Variables ¶
var DefaultRegistry = NewRegistry()
Functions ¶
func RegisterForArtifactType ¶
func SetFor ¶
func SetFor(ctx datacontext.Context, registry Registry)
Types ¶
type Handler ¶
type Handler interface {
Download(p common.Printer, racc cpi.ResourceAccess, path string, fs vfs.FileSystem) (bool, string, error)
}
type Registry ¶
type Registry interface { Register(arttype, mediatype string, hdlr Handler) LookupHandler(art, media string) []Handler Handler DownloadAsBlob(p common.Printer, racc cpi.ResourceAccess, path string, fs vfs.FileSystem) (bool, string, error) }
func For ¶
func For(ctx datacontext.Context) Registry