artifactset

package
v2.0.0-...-98cc131 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAINARTIFACT_ANNOTATION = "software.ocm/main"
	TAGS_ANNOTATION         = "software.ocm/tags"
	TYPE_ANNOTATION         = "software.ocm/type"

	OCITAG_ANNOTATION = "org.opencontainers.image.ref.name"
)
View Source
const (
	// The artifact descriptor name for artifact format.
	ArtifactSetDescriptorFileName = "artifact-descriptor.json"
	BlobsDirectoryName            = "blobs"

	OCIArtifactSetDescriptorFileName = "index.json"
	OCILayouFileName                 = "oci-layout"
)
View Source
const (
	Type   = "ArtifactSet"
	TypeV1 = Type + runtime.VersionSeparator + "v1"
)
View Source
const (
	FORMAT_OCI = "oci/v1"
	FORMAT_OCM = "ocm/v1"
)
View Source
const SynthesizedBlobFormat = "+tar+gzip"

Variables

View Source
var DefaultArtifactSetDescriptorFileName = OCIArtifactSetDescriptorFileName

Functions

func DescriptorFileName

func DescriptorFileName(format string) string

func GetFormatVersion

func GetFormatVersion(opts accessio.Options) string

func GetFormats

func GetFormats() []string

func IsOCIDefaultFormat

func IsOCIDefaultFormat() bool

func MediaType

func MediaType(mime string) string

func NewAccessObjectInfo

func NewAccessObjectInfo(fmts ...string) accessobj.AccessObjectInfo

func NewRepository

func NewRepository(ctx cpi.Context, s *RepositorySpec) (cpi.Repository, error)

func NewStateHandler

func NewStateHandler(fs vfs.FileSystem) accessobj.StateHandler

NewStateHandler implements the factory interface for the artifact set state descriptor handling Basically this is an index state.

func RetrieveMainArtifact

func RetrieveMainArtifact(m map[string]string) string

func RetrieveTags

func RetrieveTags(m map[string]string) string

func RetrieveType

func RetrieveType(m map[string]string) string

func StructureFormat

func StructureFormat(fmt string) accessio.Option

func SupportedFormats

func SupportedFormats() []accessio.FileFormat

func TransferArtifact

func TransferArtifact(art cpi.ArtifactAccess, set cpi.ArtifactSink, tags ...string) error

Types

type ArtifactBlob

type ArtifactBlob interface {
	accessio.TemporaryFileSystemBlobAccess
}

func SynthesizeArtifactBlob

func SynthesizeArtifactBlob(ns cpi.NamespaceAccess, ref string) (ArtifactBlob, error)

SynthesizeArtifactBlob synthesizes an artifact blob incorporating all side artifacts. To support extensions like cosign, we need the namespace access her to find additionally objects associated by tags.

func SynthesizeArtifactBlobFor

func SynthesizeArtifactBlobFor(tag string, iter ArtifactIterator) (ArtifactBlob, error)

SynthesizeArtifactBlobFor synthesizes an artifact blob incorporating all artifacts provided ba a factory.

func SynthesizeArtifactBlobForArtifact

func SynthesizeArtifactBlobForArtifact(art cpi.ArtifactAccess, ref string) (ArtifactBlob, error)

func SythesizeArtifactSet

func SythesizeArtifactSet(producer Producer) (ArtifactBlob, error)

type ArtifactFactory

type ArtifactFactory func(set *ArtifactSet) (digest.Digest, string, error)

ArtifactFactory add an artifact to the given set and provides descriptor metadata.

func ArtifactTransferCreator

func ArtifactTransferCreator(art cpi.ArtifactAccess, finalizer *Finalizer, feedback ...ArtifactFeedback) ArtifactFactory

ArtifactTransferCreator provides an ArtifactFactory transferring the given artifact.

type ArtifactFeedback

type ArtifactFeedback func(blob accessio.BlobAccess, art cpi.ArtifactAccess) error

ArtifactFeedback is called after an artifact has successfully be added.

type ArtifactIterator

type ArtifactIterator func() (ArtifactFactory, bool, error)

ArtifactIterator provides a sequence of artifact factories by successive calls. The sequence is finished if nil is returned for the factory.

type ArtifactSet

type ArtifactSet struct {
	cpi.NamespaceAccess
	// contains filtered or unexported fields
}

func AsArtifactSet

func AsArtifactSet(ns cpi.NamespaceAccess) (*ArtifactSet, error)

func New

func New(acc accessobj.AccessMode, fs vfs.FileSystem, setup accessobj.Setup, closer accessobj.Closer, mode vfs.FileMode, formatVersion string) (*ArtifactSet, error)

New returns a new representation based element.

func (*ArtifactSet) Annotate

func (a *ArtifactSet) Annotate(name string, value string)

func (*ArtifactSet) Close

func (a *ArtifactSet) Close() error

func (*ArtifactSet) GetAnnotation

func (a *ArtifactSet) GetAnnotation(name string) string

func (*ArtifactSet) GetBlobData

func (a *ArtifactSet) GetBlobData(digest digest.Digest) (int64, accessio.DataAccess, error)

func (*ArtifactSet) GetIndex

func (a *ArtifactSet) GetIndex() *artdesc.Index

func (*ArtifactSet) GetMain

func (a *ArtifactSet) GetMain() digest.Digest

func (*ArtifactSet) HasAnnotation

func (a *ArtifactSet) HasAnnotation(name string) bool

type FileSystemBlobAccess

type FileSystemBlobAccess struct {
	*accessobj.FileSystemBlobAccess
}

func NewFileSystemBlobAccess

func NewFileSystemBlobAccess(access *accessobj.AccessObject) *FileSystemBlobAccess

func (*FileSystemBlobAccess) AddArtifactBlob

func (i *FileSystemBlobAccess) AddArtifactBlob(artifact cpi.Artifact) (cpi.BlobAccess, error)

func (*FileSystemBlobAccess) GetArtifact

func (i *FileSystemBlobAccess) GetArtifact(access support.NamespaceAccessImpl, digest digest.Digest) (acc cpi.ArtifactAccess, err error)

type FormatHandler

type FormatHandler interface {
	accessio.Option

	Format() accessio.FileFormat

	Open(acc accessobj.AccessMode, path string, opts accessio.Options) (*Object, error)
	Create(path string, opts accessio.Options, mode vfs.FileMode) (*Object, error)
	Write(obj *Object, path string, opts accessio.Options, mode vfs.FileMode) error
}

func GetFormat

func GetFormat(name accessio.FileFormat) FormatHandler

func RegisterFormat

func RegisterFormat(f accessobj.FormatHandler) FormatHandler

type FormatVersionOption

type FormatVersionOption interface {
	SetFormatVersion(string)
	GetFormatVersion() string
}

type GetArtifactError

type GetArtifactError struct {
	Original error
	Ref      string
}

func (GetArtifactError) Error

func (e GetArtifactError) Error() string

func (GetArtifactError) Unwrap

func (e GetArtifactError) Unwrap() error

type NamespaceLister

type NamespaceLister struct{}

NamespaceLister handles the namespaces provided by an artifact set. This is always single anonymous namespace, which by ddefinition is the empty string.

func (*NamespaceLister) GetNamespaces

func (n *NamespaceLister) GetNamespaces(prefix string, closure bool) ([]string, error)

GetNamespaces returns namespaces with a given prefix. This is the anonymous namespace ("") for an empty prefix or no namespace at all if a prefix is given.

func (*NamespaceLister) NumNamespaces

func (n *NamespaceLister) NumNamespaces(prefix string) (int, error)

NumNamespaces returns the number of namespaces with a given prefix for an artifact set. This is either one (the anonymous namespace) if the prefix is empty (all namespaces) or zero if a prefix is given.

type Object

type Object = ArtifactSet

func Create

func Create(acc accessobj.AccessMode, path string, mode vfs.FileMode, opts ...accessio.Option) (*Object, error)

func Open

func Open(acc accessobj.AccessMode, path string, mode vfs.FileMode, olist ...accessio.Option) (*Object, error)

func OpenFromBlob

func OpenFromBlob(acc accessobj.AccessMode, blob accessio.BlobAccess, opts ...accessio.Option) (*Object, error)

func OpenFromDataAccess

func OpenFromDataAccess(acc accessobj.AccessMode, mime string, data accessio.DataAccess, opts ...accessio.Option) (*Object, error)

type Options

type Options struct {
	accessio.StandardOptions

	FormatVersion string `json:"formatVersion,omitempty"`
}

func NewOptions

func NewOptions(olist ...accessio.Option) (*Options, error)

func (*Options) ApplyOption

func (o *Options) ApplyOption(opts accessio.Options) error

func (*Options) GetFormatVersion

func (o *Options) GetFormatVersion() string

func (*Options) SetFormatVersion

func (o *Options) SetFormatVersion(s string)

type Producer

type Producer func(set *ArtifactSet) (string, error)

type RepositoryImpl

type RepositoryImpl struct {
	cpi.RepositoryImplBase
	// contains filtered or unexported fields
}

func (RepositoryImpl) Close

func (r RepositoryImpl) Close() error

func (*RepositoryImpl) ExistsArtifact

func (r *RepositoryImpl) ExistsArtifact(name string, ref string) (bool, error)

func (*RepositoryImpl) Get

func (r *RepositoryImpl) Get() *ArtifactSet

func (*RepositoryImpl) GetSpecification

func (r *RepositoryImpl) GetSpecification() cpi.RepositorySpec

func (*RepositoryImpl) LookupArtifact

func (r *RepositoryImpl) LookupArtifact(name string, ref string) (cpi.ArtifactAccess, error)

func (*RepositoryImpl) LookupNamespace

func (r *RepositoryImpl) LookupNamespace(name string) (cpi.NamespaceAccess, error)

func (*RepositoryImpl) NamespaceLister

func (r *RepositoryImpl) NamespaceLister() cpi.NamespaceLister

type RepositorySpec

type RepositorySpec struct {
	runtime.ObjectVersionedType `json:",inline"`
	Options                     `json:",inline"`

	// FileFormat is the format of the repository file
	FilePath string `json:"filePath"`
	// AccessMode can be set to request readonly access or creation
	AccessMode accessobj.AccessMode `json:"accessMode,omitempty"`

	FormatVersion string `json:"formatVersion,omitempty"`
}

func NewRepositorySpec

func NewRepositorySpec(acc accessobj.AccessMode, filePath string, opts ...accessio.Option) (*RepositorySpec, error)

NewRepositorySpec creates a new RepositorySpec.

func (*RepositorySpec) AsUniformSpec

func (*RepositorySpec) GetFormatVersion

func (s *RepositorySpec) GetFormatVersion() string

func (*RepositorySpec) GetType

func (a *RepositorySpec) GetType() string

func (*RepositorySpec) Name

func (s *RepositorySpec) Name() string

func (*RepositorySpec) Repository

func (a *RepositorySpec) Repository(ctx cpi.Context, creds credentials.Credentials) (cpi.Repository, error)

func (*RepositorySpec) UniformRepositorySpec

func (s *RepositorySpec) UniformRepositorySpec() *cpi.UniformRepositorySpec

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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