Documentation ¶
Index ¶
- Constants
- Variables
- func DescriptorFileName(format string) string
- func GetFormatVersion(opts accessio.Options) string
- func GetFormats() []string
- func IsOCIDefaultFormat() bool
- func MediaType(mime string) string
- func NewAccessObjectInfo(fmts ...string) accessobj.AccessObjectInfo
- func NewRepository(ctx cpi.Context, s *RepositorySpec) (cpi.Repository, error)
- func NewStateHandler(fs vfs.FileSystem) accessobj.StateHandler
- func RetrieveDigest(idx *artdesc.Index, ref string) digest.Digest
- func RetrieveMainArtifact(m map[string]string) string
- func RetrieveMainArtifactFromIndex(index *artdesc.Index) 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, mod ...ArtifactModifier) (ArtifactBlob, error)
- func SynthesizeArtifactBlobFor(tag string, iter ArtifactIterator) (ArtifactBlob, error)
- func SynthesizeArtifactBlobForArtifact(art cpi.ArtifactAccess, ref string, filter ...filters.Filter) (ArtifactBlob, error)
- func SynthesizeArtifactBlobWithFilter(ns cpi.NamespaceAccess, ref string, filter filters.Filter, ...) (ArtifactBlob, error)
- func SythesizeArtifactSet(producer Producer) (ArtifactBlob, error)
- type ArtifactFactory
- type ArtifactFeedback
- type ArtifactIterator
- type ArtifactModifier
- type ArtifactSet
- func (a *ArtifactSet) Annotate(name string, value string)
- func (a *ArtifactSet) Close() error
- func (a *ArtifactSet) GetAnnotation(name string) string
- func (a *ArtifactSet) GetBlobData(digest digest.Digest) (int64, blobaccess.DataAccess, error)
- func (a *ArtifactSet) GetDigest(ref string) digest.Digest
- func (a *ArtifactSet) GetIndex() *artdesc.Index
- func (a *ArtifactSet) GetMain() digest.Digest
- func (a *ArtifactSet) HasAnnotation(name string) bool
- func (a *ArtifactSet) SetMainArtifact(version string)
- type FileSystemBlobAccess
- type FormatHandler
- type FormatVersionOption
- type GetArtifactError
- type NamespaceLister
- type Object
- func Create(acc accessobj.AccessMode, path string, mode vfs.FileMode, ...) (*Object, error)
- func Open(acc accessobj.AccessMode, path string, mode vfs.FileMode, ...) (*Object, error)
- func OpenFromBlob(acc accessobj.AccessMode, blob blobaccess.BlobAccess, opts ...accessio.Option) (*Object, error)
- func OpenFromDataAccess(acc accessobj.AccessMode, mime string, data blobaccess.DataAccess, ...) (*Object, error)
- type Options
- type Producer
- type RepositoryImpl
- func (r RepositoryImpl) Close() error
- func (r *RepositoryImpl) ExistsArtifact(name string, ref string) (bool, error)
- func (r *RepositoryImpl) Get() *ArtifactSet
- func (r *RepositoryImpl) GetSpecification() cpi.RepositorySpec
- func (r *RepositoryImpl) LookupArtifact(name string, ref string) (cpi.ArtifactAccess, error)
- func (r *RepositoryImpl) LookupNamespace(name string) (cpi.NamespaceAccess, error)
- func (r *RepositoryImpl) NamespaceLister() cpi.NamespaceLister
- 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 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 RetrieveDigest ¶
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 { blobaccess.BlobAccess }
func SynthesizeArtifactBlob ¶
func SynthesizeArtifactBlob(ns cpi.NamespaceAccess, ref string, mod ...ArtifactModifier) (ArtifactBlob, error)
SynthesizeArtifactBlob synthesizes an artifact blob incorporating all side artifacts. To support extensions like cosign, we need the namespace access here to find additionally objects associated by tags. (not yet implemented).
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, filter ...filters.Filter) (ArtifactBlob, error)
func SynthesizeArtifactBlobWithFilter ¶
func SynthesizeArtifactBlobWithFilter(ns cpi.NamespaceAccess, ref string, filter filters.Filter, mod ...ArtifactModifier) (ArtifactBlob, error)
SynthesizeArtifactBlobWithFilter synthesizes an artifact blob incorporating all side artifacts. To support extensions like cosign, we need the namespace access here to find additionally objects associated by tags (not yet implemented).
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 blobaccess.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 ArtifactModifier ¶
type ArtifactModifier func(access cpi.ArtifactAccess) error
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, blobaccess.DataAccess, error)
func (*ArtifactSet) GetDigest ¶
func (a *ArtifactSet) GetDigest(ref string) digest.Digest
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
func (*ArtifactSet) SetMainArtifact ¶
func (a *ArtifactSet) SetMainArtifact(version string)
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 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 blobaccess.BlobAccess, opts ...accessio.Option) (*Object, error)
func OpenFromDataAccess ¶
func OpenFromDataAccess(acc accessobj.AccessMode, mime string, data blobaccess.DataAccess, 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 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 (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