Documentation ¶
Index ¶
- Constants
- Variables
- func DescriptorFileName(format string) string
- func GetFormatVersion(opts accessio.Options) string
- func GetFormats() []string
- func IsOCIDefaultFormat() bool
- func NewAccessObjectInfo(fmts ...string) accessobj.AccessObjectInfo
- func NewStateHandler(fs vfs.FileSystem) accessobj.StateHandler
- func RetrieveMainArtifact(m map[string]string) string
- func RetrieveTags(m map[string]string) string
- func RetrieveType(m map[string]string) string
- func StructureFormat(fmt string) accessio.Option
- func SupportedFormats() []accessio.FileFormat
- func TransferArtifact(art cpi.ArtifactAccess, set cpi.ArtifactSink, tags ...string) error
- type ArtifactBlob
- func SynthesizeArtifactBlob(ns cpi.NamespaceAccess, ref string) (ArtifactBlob, error)
- func SynthesizeArtifactBlobFor(tag string, iter ArtifactIterator) (ArtifactBlob, error)
- func SynthesizeArtifactBlobForArtifact(art cpi.ArtifactAccess, ref string) (ArtifactBlob, error)
- func SythesizeArtifactSet(producer Producer) (ArtifactBlob, error)
- type ArtifactFactory
- type ArtifactFeedback
- type ArtifactIterator
- type ArtifactSet
- func (a ArtifactSet) AddArtifact(artifact cpi.Artifact, tags ...string) (access accessio.BlobAccess, err error)
- func (a ArtifactSet) AddBlob(blob cpi.BlobAccess) error
- func (a ArtifactSet) AddPlatformArtifact(artifact cpi.Artifact, platform *artdesc.Platform) (access accessio.BlobAccess, err error)
- func (a ArtifactSet) AddTags(digest digest.Digest, tags ...string) error
- func (a ArtifactSet) Annotate(name string, value string)
- func (a ArtifactSet) AnnotateArtifact(digest digest.Digest, name, value string) error
- func (s *ArtifactSet) Close() error
- func (a ArtifactSet) GetArtifact(ref string) (cpi.ArtifactAccess, error)
- func (a ArtifactSet) GetBlobData(digest digest.Digest) (int64, cpi.DataAccess, error)
- func (a ArtifactSet) GetBlobDescriptor(digest digest.Digest) *cpi.Descriptor
- func (a ArtifactSet) GetIndex() *artdesc.Index
- func (a ArtifactSet) GetMain() digest.Digest
- func (a ArtifactSet) GetNamespace() string
- func (a ArtifactSet) GetTags(digest digest.Digest) ([]string, error)
- func (a ArtifactSet) HasArtifact(ref string) (bool, error)
- func (s *ArtifactSet) IsClosed() bool
- func (a ArtifactSet) IsReadOnly() bool
- func (a ArtifactSet) ListTags() ([]string, error)
- func (a ArtifactSet) NewArtifact(artifact ...*artdesc.Artifact) (cpi.ArtifactAccess, error)
- func (a ArtifactSet) Update() error
- func (a ArtifactSet) Write(path string, mode vfs.FileMode, opts ...accessio.Option) error
- type FileSystemBlobAccess
- type FormatHandler
- type FormatVersionOption
- type GetArtifactError
- type NamespaceLister
- type Object
- type Options
- type Producer
- type Repository
- func (r Repository) Close() error
- func (r *Repository) ExistsArtifact(name string, ref string) (bool, error)
- func (r *Repository) Get() *ArtifactSet
- func (r *Repository) GetContext() cpi.Context
- func (r *Repository) GetSpecification() cpi.RepositorySpec
- func (r *Repository) LookupArtifact(name string, ref string) (cpi.ArtifactAccess, error)
- func (r *Repository) LookupNamespace(name string) (cpi.NamespaceAccess, error)
- func (r *Repository) NamespaceLister() cpi.NamespaceLister
- func (r *Repository) Open() (*ArtifactSet, error)
- type RepositorySpec
- func (a *RepositorySpec) AsUniformSpec(cpi.Context) cpi.UniformRepositorySpec
- func (s *RepositorySpec) GetFormatVersion() string
- func (a *RepositorySpec) GetType() string
- func (s *RepositorySpec) Name() string
- func (a *RepositorySpec) Repository(ctx cpi.Context, creds credentials.Credentials) (cpi.Repository, error)
- func (s *RepositorySpec) UniformRepositorySpec() *cpi.UniformRepositorySpec
Constants ¶
const ( MAINARTIFACT_ANNOTATION = "software.ocm/main" TAGS_ANNOTATION = "software.ocm/tags" TYPE_ANNOTATION = "software.ocm/type" OCITAG_ANNOTATION = "org.opencontainers.image.ref.name" )
const ( // The artifact descriptor name for artifact format. ArtifactSetDescriptorFileName = "artifact-descriptor.json" BlobsDirectoryName = "blobs" OCIArtifactSetDescriptorFileName = "index.json" OCILayouFileName = "oci-layout" )
const ( Type = "ArtifactSet" TypeV1 = Type + runtime.VersionSeparator + "v1" )
const ( FORMAT_OCI = "oci/v1" FORMAT_OCM = "ocm/v1" )
const SynthesizedBlobFormat = "+tar+gzip"
Variables ¶
var ( FormatDirectory = RegisterFormat(accessobj.FormatDirectory) FormatTAR = RegisterFormat(accessobj.FormatTAR) FormatTGZ = RegisterFormat(accessobj.FormatTGZ) )
var DefaultArtifactSetDescriptorFileName = OCIArtifactSetDescriptorFileName
Functions ¶
func DescriptorFileName ¶
func GetFormatVersion ¶
func GetFormats ¶
func GetFormats() []string
func IsOCIDefaultFormat ¶
func IsOCIDefaultFormat() bool
func NewAccessObjectInfo ¶
func NewAccessObjectInfo(fmts ...string) accessobj.AccessObjectInfo
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 RetrieveTags ¶
func RetrieveType ¶
func StructureFormat ¶
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 *utils.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 {
// contains filtered or unexported fields
}
ArtifactSet provides an artifact set view on the artifact set implementation. Every ArtifactSet is separated closable. If the last view is closed the implementation is released.
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) AddArtifact ¶
func (ArtifactSet) AddBlob ¶
func (a ArtifactSet) AddBlob(blob cpi.BlobAccess) error
func (ArtifactSet) AddPlatformArtifact ¶
func (ArtifactSet) AnnotateArtifact ¶
func (*ArtifactSet) Close ¶
func (s *ArtifactSet) Close() error
func (ArtifactSet) GetArtifact ¶
func (a ArtifactSet) GetArtifact(ref string) (cpi.ArtifactAccess, error)
func (ArtifactSet) GetBlobData ¶
func (a ArtifactSet) GetBlobData(digest digest.Digest) (int64, cpi.DataAccess, error)
func (ArtifactSet) GetBlobDescriptor ¶
func (a ArtifactSet) GetBlobDescriptor(digest digest.Digest) *cpi.Descriptor
func (ArtifactSet) GetIndex ¶
GetIndex returns the index of the included artifacts (image manifests and image indices) The manifst entries may describe dedicated tags to use for the dedicated artifact as annotation with the key TAGS_ANNOTATION.
func (ArtifactSet) GetMain ¶
func (a ArtifactSet) GetMain() digest.Digest
GetMain returns the digest of the main artifact described by this artifact set. There might be more, if the main artifact is an index.
func (ArtifactSet) GetNamespace ¶
func (a ArtifactSet) GetNamespace() string
func (ArtifactSet) HasArtifact ¶
func (*ArtifactSet) IsClosed ¶
func (s *ArtifactSet) IsClosed() bool
func (ArtifactSet) IsReadOnly ¶
func (a ArtifactSet) IsReadOnly() bool
func (ArtifactSet) NewArtifact ¶
func (a ArtifactSet) NewArtifact(artifact ...*artdesc.Artifact) (cpi.ArtifactAccess, error)
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.ArtifactSetContainerImpl, 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 GetArtifactError ¶
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 OpenFromBlob ¶
func OpenFromBlob(acc accessobj.AccessMode, blob accessio.BlobAccess, opts ...accessio.Option) (*Object, error)
type Options ¶
type Options struct { accessio.StandardOptions FormatVersion string `json:"formatVersion,omitempty"` }
func (*Options) GetFormatVersion ¶
func (*Options) SetFormatVersion ¶
type Producer ¶
type Producer func(set *ArtifactSet) (string, error)
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(ctx cpi.Context, s *RepositorySpec) (*Repository, error)
func (Repository) Close ¶
func (r Repository) Close() error
func (*Repository) ExistsArtifact ¶
func (r *Repository) ExistsArtifact(name string, ref string) (bool, error)
func (*Repository) Get ¶
func (r *Repository) Get() *ArtifactSet
func (*Repository) GetContext ¶
func (r *Repository) GetContext() cpi.Context
func (*Repository) GetSpecification ¶
func (r *Repository) GetSpecification() cpi.RepositorySpec
func (*Repository) LookupArtifact ¶
func (r *Repository) LookupArtifact(name string, ref string) (cpi.ArtifactAccess, error)
func (*Repository) LookupNamespace ¶
func (r *Repository) LookupNamespace(name string) (cpi.NamespaceAccess, error)
func (*Repository) NamespaceLister ¶
func (r *Repository) NamespaceLister() cpi.NamespaceLister
func (*Repository) Open ¶
func (r *Repository) Open() (*ArtifactSet, error)
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 (a *RepositorySpec) AsUniformSpec(cpi.Context) cpi.UniformRepositorySpec
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