Documentation ¶
Index ¶
- Variables
- func ContentTypesFilterHandler(handler images.HandlerFunc, contentTypes ...string) images.HandlerFunc
- func CopyAndCreateDescriptor(reader io.Reader, writer io.Writer) (ocispec.Descriptor, error)
- func CopyChildrenFromHandler(ctx context.Context, handler images.HandlerFunc, from content.Provider, ...) error
- func CopyContent(ctx context.Context, from content.Provider, to content.Ingester, ...) error
- func CopyContentHandler(handler images.HandlerFunc, from content.Provider, to content.Ingester) images.HandlerFunc
- func CopyJSONToFileAndCreateDescriptor(inf interface{}, outFile string) (ocispec.Descriptor, error)
- func CopyReaderToFileAndCreateDescriptor(reader io.Reader, outFile string) (ocispec.Descriptor, error)
- func DescriptorToURL(reg string, desc ocispec.Descriptor) (string, error)
- func ExtendedResolver(resolver remotes.Resolver, hosts docker.RegistryHosts) remotes.Resolver
- func FetchAndJSONDecode(ctx context.Context, fetch remotes.FetcherFunc, desc ocispec.Descriptor, ...) error
- func FetchertoProvider(fetcher remotes.Fetcher) content.Provider
- func GenerateBuildFilesHandler(handler images.HandlerFunc, layoutRoot string, provider content.Provider) images.HandlerFunc
- func GetLayerDiffID(ctx context.Context, store content.Store, desc ocispec.Descriptor) (digest.Digest, error)
- func ImageConfigFromProvider(ctx context.Context, provider content.Provider, desc ocispec.Descriptor) (ocispec.Image, error)
- func ImageConfigToPlatform(cfg ocispec.Image) ocispec.Platform
- func ImageIndexFromProvider(ctx context.Context, provider content.Provider, desc ocispec.Descriptor) (ocispec.Index, error)
- func ImageManifestFromProvider(ctx context.Context, provider content.Provider, desc ocispec.Descriptor) (ocispec.Manifest, error)
- func IngestorJSONEncode(ctx context.Context, ing content.Ingester, mediaType string, inf interface{}) (ocispec.Descriptor, error)
- func IsEmptyPlatform(plat *ocispec.Platform) bool
- func ManifestFromIndex(manifest ocispec.Index, platform platforms.MatchComparer) (ocispec.Descriptor, error)
- func MultiProvider(providers ...content.Provider) content.Provider
- func NamedRef(ref string) (dref.Named, error)
- func NewTarIngestor(path string) content.Ingester
- func ProviderJSONDecode(ctx context.Context, provider content.Provider, desc ocispec.Descriptor, ...) error
- func ReadDescriptorFromFile(path string) (ocispec.Descriptor, error)
- func RefToPath(ref string) (string, error)
- func RefToRegistryName(ref string) (string, error)
- func ResolvePlatformFromDescriptor(ctx context.Context, provider content.Provider, desc ocispec.Descriptor) (ocispec.Platform, error)
- func SplitStore(ing content.Ingester, prov content.Provider) content.Store
- func WriteDescriptorToFile(path string, desc ocispec.Descriptor) error
- type ProviderWrapper
- type RepositoryIngester
- type Resolver
- func (resolver Resolver) MarshalAndPushContent(ctx context.Context, ref string, content interface{}, mediaType string) (ocispec.Descriptor, error)
- func (resolver Resolver) PushBlob(ctx context.Context, path, ref, mediaType string) (ocispec.Descriptor, error)
- func (resolver Resolver) PushImageIndexShallow(ctx context.Context, idx ocispec.Index, ref string) (ocispec.Descriptor, error)
- type WriterCounter
Constants ¶
This section is empty.
Variables ¶
var (
PublicVisibility = []string{"//visibility:public"}
)
Functions ¶
func ContentTypesFilterHandler ¶
func ContentTypesFilterHandler(handler images.HandlerFunc, contentTypes ...string) images.HandlerFunc
ContentTypesFilterHandler filters the children of the handler to only include the listed content types
func CopyAndCreateDescriptor ¶
CopyAndCreateDescriptor copys a reader to a writer and returns a descriptor, note that this desciptor will only have the Digest and Size fields populated.
func CopyChildrenFromHandler ¶
func CopyChildrenFromHandler(ctx context.Context, handler images.HandlerFunc, from content.Provider, to content.Ingester, parent ocispec.Descriptor) error
CopyChildrenFromHandler performs a recursive depth-first copy of the parent descriptors children (as returned by calling handler on the parent) from the provider to the ingester
func CopyContent ¶
func CopyContent(ctx context.Context, from content.Provider, to content.Ingester, desc ocispec.Descriptor) error
CopyContent copies a descriptor from a provider to an ingestor interfaces provider by "containerd/content". Useful when you want to copy between layouts or when pulling an image via oras.ProviderWrapper
func CopyContentHandler ¶
func CopyContentHandler(handler images.HandlerFunc, from content.Provider, to content.Ingester) images.HandlerFunc
CopyContentHandler copies the parent descriptor from the provider to the ingestor
func CopyJSONToFileAndCreateDescriptor ¶
func CopyJSONToFileAndCreateDescriptor(inf interface{}, outFile string) (ocispec.Descriptor, error)
CopyJSONToFileAndCreateDescriptor encodes inf to json and then writes it to a file, returning the descriptor.
func CopyReaderToFileAndCreateDescriptor ¶
func CopyReaderToFileAndCreateDescriptor(reader io.Reader, outFile string) (ocispec.Descriptor, error)
CopyReaderToFileAndCreateDescriptor copys a reader to a file and then returns a descriptor.
func DescriptorToURL ¶
func DescriptorToURL(reg string, desc ocispec.Descriptor) (string, error)
DescriptortoURL converts a combination of a registry and a descriptor to a URL that the blob can be downloaded from.
func ExtendedResolver ¶
func FetchAndJSONDecode ¶
func FetchAndJSONDecode(ctx context.Context, fetch remotes.FetcherFunc, desc ocispec.Descriptor, inf interface{}) error
FetchAndJSONDecodefetches a the content from a descriptor and unmarshalls it into a struct
func GenerateBuildFilesHandler ¶
func GenerateBuildFilesHandler(handler images.HandlerFunc, layoutRoot string, provider content.Provider) images.HandlerFunc
GenerateBuildFilesHandler generates build files while walking a tree. TODO Ideally, this should actually be a content.WalkFunc, but ocilayout doesn't implement this interface yet
func GetLayerDiffID ¶
func GetLayerDiffID(ctx context.Context, store content.Store, desc ocispec.Descriptor) (digest.Digest, error)
GetLayerDiffID will return the diff ID of a given layer descriptor to be used within an image config. If a layer is uncompressed, the diff ID is simply the digest but if the layer is compressed, we must uncompress the file and acquire the digest.
func ImageConfigFromProvider ¶
func ImageConfigFromProvider(ctx context.Context, provider content.Provider, desc ocispec.Descriptor) (ocispec.Image, error)
ImageConfigFromProvider fetches an image config from a provider and decodes it. The descriptor must point directly at the image config.
XXX: This function assumes that the data is json encoded.
func ImageConfigToPlatform ¶
imageConfigToPlatform creates a Platform from an Image Config type
func ImageIndexFromProvider ¶
func ImageIndexFromProvider(ctx context.Context, provider content.Provider, desc ocispec.Descriptor) (ocispec.Index, error)
ImageIndexFromProvider fetches an image index from a provider and decodes it.
XXX: This function assumes that the data is json encoded.
func ImageManifestFromProvider ¶
func ImageManifestFromProvider(ctx context.Context, provider content.Provider, desc ocispec.Descriptor) (ocispec.Manifest, error)
ImageManifestFromProvider fetches an image manifest from a provider and decodes it.
XXX: This function assumes that the data is json encoded.
func IngestorJSONEncode ¶
func IngestorJSONEncode(ctx context.Context, ing content.Ingester, mediaType string, inf interface{}) (ocispec.Descriptor, error)
IngestorJSONEncode encodes json and saves it to a ingester.
func IsEmptyPlatform ¶
func ManifestFromIndex ¶
func ManifestFromIndex(manifest ocispec.Index, platform platforms.MatchComparer) (ocispec.Descriptor, error)
ManifestFromIndex gets an OCI Manifest from an image index that matches the desired platform.
func MultiProvider ¶
MultiProvider will read from the first provider that can read the requrested descriptor.
func NewTarIngestor ¶
func ProviderJSONDecode ¶
func ProviderJSONDecode(ctx context.Context, provider content.Provider, desc ocispec.Descriptor, inf interface{}) error
ProviderJSONDecode fetches content content from a provider and decodes the json content.
func ReadDescriptorFromFile ¶
func ReadDescriptorFromFile(path string) (ocispec.Descriptor, error)
DescriptorFromFile reads an OCI descriptor from a file path.
XXX Descriptor must be json encoded
func RefToRegistryName ¶
RefToRegistryName will return a hostname of a registry given a reference string.
func ResolvePlatformFromDescriptor ¶
func ResolvePlatformFromDescriptor(ctx context.Context, provider content.Provider, desc ocispec.Descriptor) (ocispec.Platform, error)
ResolvePlatformFromDescriptor resolves a platform from an image manifest, by looking at the OS and Arch variables in the image config
func SplitStore ¶
SplitStore implementents content.Store, where reads are from a different store than writes.
func WriteDescriptorToFile ¶
func WriteDescriptorToFile(path string, desc ocispec.Descriptor) error
WriteDescriptorToFile writes an OCI descriptor to a file.
Types ¶
type ProviderWrapper ¶
ProviderWrapper wraps a remote.Fetcher to make a content.Provider, which is useful for things
func (*ProviderWrapper) ReaderAt ¶
func (p *ProviderWrapper) ReaderAt(ctx context.Context, desc ocispec.Descriptor) (content.ReaderAt, error)
type RepositoryIngester ¶
type Resolver ¶
func DefaultResolver ¶
func DefaultResolver() Resolver
DefaultResolver returns a resolver with credential helper auth and ocitool extensions.
func ResolverWithHeaders ¶
ResolverWithHeaders returns a resolver with credential helper auth and ocitool extensions.
func (Resolver) MarshalAndPushContent ¶
func (Resolver) PushBlob ¶
func (resolver Resolver) PushBlob(ctx context.Context, path, ref, mediaType string) (ocispec.Descriptor, error)
PushBlob pushes a singluar blob to a registry.
func (Resolver) PushImageIndexShallow ¶
func (resolver Resolver) PushImageIndexShallow(ctx context.Context, idx ocispec.Index, ref string) (ocispec.Descriptor, error)
PushImageIndexShallow pushes a new image index to a repository without pulling all of the dependent descriptors, aka it doesn't need to pull any of the dependent images.
XXX Currently there is a major limitation that you can only push an index who's dependencies all coexist within the same repository. To support cross-repository shallow pushes we would need to mount blobs to this repository. `containerd` has some nice facilities to walk descriptors. https://github.com/opencontainers/distribution-spec/blob/main/spec.md#mounting-a-blob-from-another-repository
type WriterCounter ¶
WriterCounter is counter for io.Writer, doesn't prevent concurrent writes.
func NewWriterCounter ¶
func NewWriterCounter(w io.Writer) *WriterCounter
NewWriterCounter function create new WriterCounter
func (*WriterCounter) Count ¶
func (counter *WriterCounter) Count() uint64
Count function return counted bytes