oras

package
Version: v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2022 License: Apache-2.0 Imports: 22 Imported by: 15

Documentation

Overview

Copyright The ORAS Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright The ORAS Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright The ORAS Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrResolverUndefined     = errors.New("resolver undefined")
	ErrFromResolverUndefined = errors.New("from target resolver undefined")
	ErrToResolverUndefined   = errors.New("to target resolver undefined")
	ErrFromTargetUndefined   = errors.New("from target undefined")
	ErrToTargetUndefined     = errors.New("from target undefined")
)

Common errors

View Source
var (
	ErrDirtyPath               = errors.New("dirty path")
	ErrPathNotSlashSeparated   = errors.New("path not slash separated")
	ErrAbsolutePathDisallowed  = errors.New("absolute path disallowed")
	ErrPathTraversalDisallowed = errors.New("path traversal disallowed")
)

Path validation related errors

View Source
var ErrStopProcessing = fmt.Errorf("stop processing")

ErrStopProcessing is used to stop processing an oras operation. This error only makes sense in sequential pulling operation.

Functions

func Copy added in v0.5.0

func Copy(ctx context.Context, from target.Target, fromRef string, to target.Target, toRef string, opts ...CopyOpt) (ocispec.Descriptor, error)

Copy copy a ref from one target.Target to a ref in another target.Target. If toRef is blank, reuses fromRef Returns the root Descriptor of the copied item. Can use the root to retrieve child elements from target.Target.

func ValidateNameAsPath

func ValidateNameAsPath(desc ocispec.Descriptor) error

ValidateNameAsPath validates name in the descriptor as file path in order to generate good packages intended to be pulled using the FileStore or the oras cli. For cross-platform considerations, only unix paths are accepted.

func WithPullByBFS

func WithPullByBFS(o *copyOpts) error

WithPullByBFS opt to pull in sequence with breath-first search

Types

type CopyOpt added in v0.5.0

type CopyOpt func(o *copyOpts) error

func WithAdditionalCachedMediaTypes

func WithAdditionalCachedMediaTypes(cachedMediaTypes ...string) CopyOpt

WithAdditionalCachedMediaTypes adds media types normally cached in memory when pulling. This does not replace the default media types, but appends to them

func WithAllowedMediaType

func WithAllowedMediaType(allowedMediaTypes ...string) CopyOpt

WithAllowedMediaType sets the allowed media types

func WithAllowedMediaTypes

func WithAllowedMediaTypes(allowedMediaTypes []string) CopyOpt

WithAllowedMediaTypes sets the allowed media types

func WithContentStore added in v0.5.0

func WithContentStore(store orascontent.Store) CopyOpt

WithContentProvideIngester opt to the provided Provider and Ingester for file system I/O, including caches.

func WithLayerDescriptors added in v0.5.0

func WithLayerDescriptors(save func([]ocispec.Descriptor)) CopyOpt

WithLayerDescriptors passes the slice of Descriptors for layers to the provided func. If the passed parameter is nil, returns an error.

func WithNameValidation

func WithNameValidation(validate func(desc ocispec.Descriptor) error) CopyOpt

WithNameValidation validates the image title in the descriptor. Pass nil to disable name validation.

func WithPullBaseHandler

func WithPullBaseHandler(handlers ...images.Handler) CopyOpt

WithPullBaseHandler provides base handlers, which will be called before any pull specific handlers.

func WithPullCallbackHandler

func WithPullCallbackHandler(handlers ...images.Handler) CopyOpt

WithPullCallbackHandler provides callback handlers, which will be called after any pull specific handlers.

func WithPullEmptyNameAllowed

func WithPullEmptyNameAllowed() CopyOpt

WithPullEmptyNameAllowed allows pulling blobs with empty name.

func WithPullStatusTrack

func WithPullStatusTrack(writer io.Writer) CopyOpt

WithPullStatusTrack report results to stdout

func WithRootManifest added in v0.5.0

func WithRootManifest(save func(b []byte)) CopyOpt

WithRootManifest passes the root manifest for the artifacts to the provided func. If the passed parameter is nil, returns an error.

func WithUserAgent added in v0.5.0

func WithUserAgent(agent string) CopyOpt

WithUserAgent set the user agent string in http communications

type ProviderWrapper added in v0.5.0

type ProviderWrapper struct {
	Fetcher remotes.Fetcher
}

ProviderWrapper wraps a remote.Fetcher to make a content.Provider, which is useful for things

func (*ProviderWrapper) ReaderAt added in v0.5.0

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL