localblob

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 8 Imported by: 3

README

Access Method localBlob - OCM Repository Local Blob Access

Synopsis
type: localBlob/v1

Provided blobs use the following media type: attribute mediaType

Description

This method is used to store a resource blob along with the component descriptor on behalf of the hosting OCM repository.

Its implementation is specific to the implementation of OCM repository used to read the component descriptor. Every repository implementation may decide how and where local blobs are stored, but it MUST provide an implementation for this method.

Regardless of the chosen implementation the attribute specification is defined globally the same.

Supported specification version is v1

Specification Versions
Version v1

The type specific specification fields are:

  • localReference string

    Repository type specific location information as string. The value may encode any deep structure, but typically just an access path is sufficient.

  • mediaType string

    The media type of the blob used to store the resource. It may add format information like +tar or +gzip.

  • referenceName (optional) string

    This optional attribute may contain identity information used by other repositories to restore some global access with an identity related to the original source.

    For example, if an OCI artifact originally referenced using the access method ociArtifact is stored during some transport step as local artifact, the reference name can be set to its original repository name. An import step into an OCI based OCM repository may then decide to make this artifact available again as regular OCI artifact.

  • globalAccess (optional) access method specification

    If a resource blob is stored locally, the repository implementation may decide to provide an external access information (independent of the OCM model).

    For example, an OCI artifact stored as local blob can be additionally stored as regular OCI artifact in an OCI registry.

    This additional external access information can be added using a second external access method specification.

Go Bindings

The go binding can be found here

Storage Mapping

Transporting component versions by value internalizes externally referenced content (for example OCI image references). Those resources will then be stored as local blobs using the media type provided by the original blob.

When importing such a local blob into a repository again, it might be possible to provide an external access, again. This will be handled by registered blob handlers.

Provided Blob Handlers

The standard tool set uses the following registered blob handlers:

  • Blob handler for importing oci artifact blobs into an OCM repository mapped to an OCI registry

    In this case the oci artifact blobs will be expanded to a regular OCI artifact taking the optional referenceNameinto account.

Additional blob handlers might be registered by local incarnations.

Documentation

Index

Constants

View Source
const (
	Type   = "localBlob"
	TypeV1 = Type + runtime.VersionSeparator + "v1"
)

Type is the access type of a blob local to a component.

Variables

This section is empty.

Functions

func AddConfig

func AddConfig(opts flagsets.ConfigOptions, config flagsets.Config) error

func Is

func Is(spec accspeccpi.AccessSpec) bool

Types

type AccessSpec

type AccessSpec struct {
	runtime.InternalVersionedTypedObject[accspeccpi.AccessSpec]
	// LocalReference is the repository local identity of the blob.
	// it is used by the repository implementation to get access
	// to the blob and if therefore specific to a dedicated repository type.
	LocalReference string `json:"localReference"`
	// MediaType is the media type of the object represented by the blob
	MediaType string `json:"mediaType"`

	// GlobalAccess is an optional field describing a possibility
	// for a global access. If given, it MUST describe a global access method.
	GlobalAccess *accspeccpi.AccessSpecRef `json:"globalAccess,omitempty"`
	// ReferenceName is an optional static name the object should be
	// use in a local repository context. It is use by a repository
	// to optionally determine a globally referencable access according
	// to the OCI distribution spec. The result will be stored
	// by the repository in the field ImageReference.
	// The value is typically an OCI repository name optionally
	// followed by a colon ':' and a tag
	ReferenceName string `json:"referenceName,omitempty"`
}

AccessSpec describes the access for a local blob.

func Decode added in v0.3.0

func Decode(data []byte) (*AccessSpec, error)

func New

func New(local, hint string, mediaType string, global accspeccpi.AccessSpec) *AccessSpec

New creates a new localFilesystemBlob accessor.

func (*AccessSpec) AccessMethod

func (*AccessSpec) Describe

func (a *AccessSpec) Describe(ctx accspeccpi.Context) string

func (*AccessSpec) GetInexpensiveContentVersionIdentity added in v0.3.0

func (a *AccessSpec) GetInexpensiveContentVersionIdentity(cv accspeccpi.ComponentVersionAccess) string

func (*AccessSpec) GetMimeType

func (a *AccessSpec) GetMimeType() string

func (*AccessSpec) GetReferenceHint

func (a *AccessSpec) GetReferenceHint(cv accspeccpi.ComponentVersionAccess) string

func (*AccessSpec) GlobalAccessSpec added in v0.3.0

func (a *AccessSpec) GlobalAccessSpec(ctx accspeccpi.Context) accspeccpi.AccessSpec

func (*AccessSpec) IsLocal

func (a *AccessSpec) IsLocal(accspeccpi.Context) bool

func (AccessSpec) MarshalJSON

func (a AccessSpec) MarshalJSON() ([]byte, error)

type AccessSpecV1

type AccessSpecV1 struct {
	runtime.ObjectVersionedType `json:",inline"`
	// LocalReference is the repository local identity of the blob.
	// it is used by the repository implementation to get access
	// to the blob and if therefore specific to a dedicated repository type.
	LocalReference string `json:"localReference"`
	// MediaType is the media type of the object represented by the blob
	MediaType string `json:"mediaType"`

	// GlobalAccess is an optional field describing a possibility
	// for a global access. If given, it MUST describe a global access method.
	GlobalAccess *accspeccpi.AccessSpecRef `json:"globalAccess,omitempty"`
	// ReferenceName is an optional static name the object should be
	// use in a local repository context. It is use by a repository
	// to optionally determine a globally referencable access according
	// to the OCI distribution spec. The result will be stored
	// by the repository in the field ImageReference.
	// The value is typically an OCI repository name optionally
	// followed by a colon ':' and a tag
	ReferenceName string `json:"referenceName,omitempty"`
}

Jump to

Keyboard shortcuts

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