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 ¶
- Variables
- func Copy(ctx context.Context, from target.Target, fromRef string, to target.Target, ...) (ocispec.Descriptor, error)
- func ValidateNameAsPath(desc ocispec.Descriptor) error
- func WithPullByBFS(o *copyOpts) error
- type CopyOpt
- func WithAdditionalCachedMediaTypes(cachedMediaTypes ...string) CopyOpt
- func WithAllowedMediaType(allowedMediaTypes ...string) CopyOpt
- func WithAllowedMediaTypes(allowedMediaTypes []string) CopyOpt
- func WithContentStore(store orascontent.Store) CopyOpt
- func WithLayerDescriptors(save func([]ocispec.Descriptor)) CopyOpt
- func WithNameValidation(validate func(desc ocispec.Descriptor) error) CopyOpt
- func WithPullBaseHandler(handlers ...images.Handler) CopyOpt
- func WithPullCallbackHandler(handlers ...images.Handler) CopyOpt
- func WithPullEmptyNameAllowed() CopyOpt
- func WithPullStatusTrack(writer io.Writer) CopyOpt
- func WithRootManifest(save func(b []byte)) CopyOpt
- func WithUserAgent(agent string) CopyOpt
- type ProviderWrapper
Constants ¶
This section is empty.
Variables ¶
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
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
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 ¶
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 ¶
type CopyOpt func(o *copyOpts) error
func WithAdditionalCachedMediaTypes ¶
WithAdditionalCachedMediaTypes adds media types normally cached in memory when pulling. This does not replace the default media types, but appends to them
func WithAllowedMediaType ¶
WithAllowedMediaType sets the allowed media types
func WithAllowedMediaTypes ¶
WithAllowedMediaTypes sets the allowed media types
func WithContentStore ¶
func WithContentStore(store orascontent.Store) CopyOpt
WithContentProvideIngester opt to the provided Provider and Ingester for file system I/O, including caches.
func WithLayerDescriptors ¶
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 ¶
WithPullBaseHandler provides base handlers, which will be called before any pull specific handlers.
func WithPullCallbackHandler ¶
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 ¶
WithPullStatusTrack report results to stdout
func WithRootManifest ¶
WithRootManifest passes the root manifest for the artifacts to the provided func. If the passed parameter is nil, returns an error.
func WithUserAgent ¶
WithUserAgent set the user agent string in http communications
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)