Documentation
¶
Index ¶
- Constants
- Variables
- func ErrUnknownArtifact(name, version string) error
- func NewStrictRepositoryTypeScheme(base ...RepositoryTypeScheme) runtime.VersionedTypeRegistry[RepositorySpec, RepositoryType]
- func RegisterRepositorySpecHandler(hdlr RepositorySpecHandler, types ...string)
- func RegisterRepositoryType(atype RepositoryType)
- type Artifact
- type ArtifactAccess
- type ArtifactAccessImpl
- type ArtifactAccessSlaves
- type ArtifactSink
- type ArtifactSource
- type BlobAccess
- type BlobSink
- type BlobSource
- type Builder
- func (b Builder) Bound() (Context, context.Context)
- func (b Builder) New(m ...datacontext.BuilderMode) Context
- func (b Builder) WithContext(ctx context.Context) Builder
- func (b Builder) WithCredentials(ctx credentials.Context) Builder
- func (b Builder) WithRepositorySpecHandlers(reg RepositorySpecHandlers) Builder
- func (b Builder) WithRepositoyTypeScheme(scheme RepositoryTypeScheme) Builder
- type ConsumerIdentityProvider
- type Context
- type ContextProvider
- type DataAccess
- type GenericRepositorySpec
- func (s *GenericRepositorySpec) Evaluate(ctx Context) (RepositorySpec, error)
- func (s *GenericRepositorySpec) Name() string
- func (s *GenericRepositorySpec) Repository(ctx Context, creds credentials.Credentials) (Repository, error)
- func (s *GenericRepositorySpec) UniformRepositorySpec() *UniformRepositorySpec
- type IndexAccess
- type IntermediateRepositorySpecAspect
- type ManifestAccess
- type NamespaceAccess
- type NamespaceAccessImpl
- type NamespaceLister
- type Repository
- type RepositoryImpl
- type RepositorySource
- type RepositorySpec
- type RepositorySpecDecoder
- type RepositorySpecHandler
- type RepositorySpecHandlers
- type RepositoryType
- type RepositoryTypeProvider
- type RepositoryTypeScheme
- type UniformRepositorySpec
- type UnknownRepositorySpec
Constants ¶
const ( KIND_OCIARTIFACT = "oci artifact" KIND_BLOB = blobaccess.KIND_BLOB KIND_MEDIATYPE = blobaccess.KIND_MEDIATYPE )
const CONTEXT_TYPE = "oci" + datacontext.OCM_CONTEXT_SUFFIX
const CommonTransportFormat = "CommonTransportFormat"
Variables ¶
var DefaultContext = Builder{}.New(datacontext.MODE_SHARED)
DefaultContext is the default context initialized by init functions.
var DefaultRepositorySpecHandlers = NewRepositorySpecHandlers()
var DefaultRepositoryTypeScheme = NewRepositoryTypeScheme(nil)
DefaultRepositoryTypeScheme contains all globally known access serializer.
Functions ¶
func ErrUnknownArtifact ¶
func NewStrictRepositoryTypeScheme ¶ added in v0.3.0
func NewStrictRepositoryTypeScheme(base ...RepositoryTypeScheme) runtime.VersionedTypeRegistry[RepositorySpec, RepositoryType]
func RegisterRepositorySpecHandler ¶
func RegisterRepositorySpecHandler(hdlr RepositorySpecHandler, types ...string)
func RegisterRepositoryType ¶
func RegisterRepositoryType(atype RepositoryType)
Types ¶
type Artifact ¶
type Artifact artdesc.ArtifactDescriptor
type ArtifactAccess ¶
type ArtifactAccess interface {
resource.ResourceView[ArtifactAccess]
ArtifactAccessImpl
ArtifactAccessSlaves
}
type ArtifactAccessImpl ¶ added in v0.3.0
type ArtifactAccessImpl interface {
Artifact
BlobSource
BlobSink
GetDescriptor() *artdesc.Artifact
GetBlob(digest digest.Digest) (BlobAccess, error)
GetArtifact(digest digest.Digest) (ArtifactAccess, error)
AddBlob(BlobAccess) error
AddArtifact(Artifact, *artdesc.Platform) (BlobAccess, error)
AddLayer(BlobAccess, *artdesc.Descriptor) (int, error)
NewArtifact(...Artifact) (ArtifactAccess, error)
io.Closer
}
type ArtifactAccessSlaves ¶ added in v0.3.0
type ArtifactAccessSlaves interface {
ManifestAccess() ManifestAccess
IndexAccess() IndexAccess
}
type ArtifactSink ¶
type ArtifactSink interface {
AddBlob(BlobAccess) error
AddArtifact(a Artifact, tags ...string) (BlobAccess, error)
AddTags(digest digest.Digest, tags ...string) error
}
type ArtifactSource ¶
type ArtifactSource interface {
GetArtifact(version string) (ArtifactAccess, error)
GetBlobData(digest digest.Digest) (int64, DataAccess, error)
}
type BlobAccess ¶
type BlobAccess = blobaccess.BlobAccess
type BlobSink ¶
type BlobSink interface {
AddBlob(BlobAccess) error
}
type BlobSource ¶
type BlobSource interface {
GetBlobData(digest digest.Digest) (int64, DataAccess, error)
}
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func (Builder) New ¶
func (b Builder) New(m ...datacontext.BuilderMode) Context
func (Builder) WithCredentials ¶
func (b Builder) WithCredentials(ctx credentials.Context) Builder
func (Builder) WithRepositorySpecHandlers ¶
func (b Builder) WithRepositorySpecHandlers(reg RepositorySpecHandlers) Builder
func (Builder) WithRepositoyTypeScheme ¶
func (b Builder) WithRepositoyTypeScheme(scheme RepositoryTypeScheme) Builder
type ConsumerIdentityProvider ¶ added in v0.3.0
type ConsumerIdentityProvider = credentials.ConsumerIdentityProvider
ConsumerIdentityProvider is an optional interface for repositories to tell about their credential requests.
type Context ¶
type Context interface {
datacontext.Context
config.ContextProvider
credentials.ContextProvider
ContextProvider
RepositorySpecHandlers() RepositorySpecHandlers
MapUniformRepositorySpec(u *UniformRepositorySpec) (RepositorySpec, error)
RepositoryTypes() RepositoryTypeScheme
RepositoryForSpec(spec RepositorySpec, creds ...credentials.CredentialsSource) (Repository, error)
RepositoryForConfig(data []byte, unmarshaler runtime.Unmarshaler, creds ...credentials.CredentialsSource) (Repository, error)
GetAlias(name string) RepositorySpec
SetAlias(name string, spec RepositorySpec)
}
func ForContext ¶
ForContext returns the Context to use for context.Context. This is either an explicit context or the default context.
func FromProvider ¶ added in v0.3.0
func FromProvider(p ContextProvider) Context
type ContextProvider ¶
type ContextProvider interface {
OCIContext() Context
}
type DataAccess ¶
type DataAccess = blobaccess.DataAccess
type GenericRepositorySpec ¶
type GenericRepositorySpec struct {
runtime.UnstructuredVersionedTypedObject `json:",inline"`
}
func ToGenericRepositorySpec ¶
func ToGenericRepositorySpec(spec RepositorySpec) (*GenericRepositorySpec, error)
func (*GenericRepositorySpec) Evaluate ¶
func (s *GenericRepositorySpec) Evaluate(ctx Context) (RepositorySpec, error)
func (*GenericRepositorySpec) Name ¶
func (s *GenericRepositorySpec) Name() string
func (*GenericRepositorySpec) Repository ¶
func (s *GenericRepositorySpec) Repository(ctx Context, creds credentials.Credentials) (Repository, error)
func (*GenericRepositorySpec) UniformRepositorySpec ¶
func (s *GenericRepositorySpec) UniformRepositorySpec() *UniformRepositorySpec
type IndexAccess ¶
type IndexAccess interface {
Artifact
GetDescriptor() *artdesc.Index
GetBlobDescriptor(digest digest.Digest) *artdesc.Descriptor
GetBlob(digest digest.Digest) (BlobAccess, error)
GetArtifact(digest digest.Digest) (ArtifactAccess, error)
AddBlob(BlobAccess) error
AddArtifact(Artifact, *artdesc.Platform) (BlobAccess, error)
}
type IntermediateRepositorySpecAspect ¶
type IntermediateRepositorySpecAspect interface {
IsIntermediate() bool
}
type ManifestAccess ¶
type ManifestAccess interface {
Artifact
GetDescriptor() *artdesc.Manifest
GetBlobDescriptor(digest digest.Digest) *artdesc.Descriptor
GetConfigBlob() (BlobAccess, error)
GetBlob(digest digest.Digest) (BlobAccess, error)
AddBlob(BlobAccess) error
AddLayer(BlobAccess, *artdesc.Descriptor) (int, error)
SetConfigBlob(blob BlobAccess, d *artdesc.Descriptor) error
}
type NamespaceAccess ¶
type NamespaceAccess interface {
resource.ResourceView[NamespaceAccess]
NamespaceAccessImpl
}
type NamespaceAccessImpl ¶ added in v0.3.0
type NamespaceAccessImpl interface {
ArtifactSource
ArtifactSink
GetNamespace() string
ListTags() ([]string, error)
HasArtifact(vers string) (bool, error)
NewArtifact(...Artifact) (ArtifactAccess, error)
io.Closer
}
type NamespaceLister ¶
type NamespaceLister interface {
// NumNamespaces returns the number of namespaces found for a prefix
// If the given prefix does not end with a /, a repository with the
// prefix name is included
NumNamespaces(prefix string) (int, error)
// GetNamespaces returns the name of namespaces found for a prefix
// If the given prefix does not end with a /, a repository with the
// prefix name is included
GetNamespaces(prefix string, closure bool) ([]string, error)
}
NamespaceLister provides the optional repository list functionality of a repository.
type Repository ¶
type Repository interface {
resource.ResourceView[Repository]
RepositoryImpl
}
type RepositoryImpl ¶ added in v0.3.0
type RepositoryImpl interface {
GetSpecification() RepositorySpec
GetContext() Context
NamespaceLister() NamespaceLister
ExistsArtifact(name string, ref string) (bool, error)
LookupArtifact(name string, ref string) (ArtifactAccess, error)
LookupNamespace(name string) (NamespaceAccess, error)
io.Closer
}
type RepositorySource ¶
type RepositorySource interface {
GetRepository() Repository
}
type RepositorySpec ¶
type RepositorySpec interface {
runtime.VersionedTypedObject
Name() string
UniformRepositorySpec() *UniformRepositorySpec
Repository(Context, credentials.Credentials) (Repository, error)
}
func CreateRepositorySpec ¶
func CreateRepositorySpec(t runtime.TypedObject) (RepositorySpec, error)
func NewGenericRepositorySpec ¶
func NewGenericRepositorySpec(data []byte, unmarshaler runtime.Unmarshaler) (RepositorySpec, error)
type RepositorySpecDecoder ¶ added in v0.3.0
type RepositorySpecDecoder = runtime.TypedObjectDecoder[RepositorySpec]
type RepositorySpecHandler ¶
type RepositorySpecHandler interface {
MapReference(ctx Context, u *UniformRepositorySpec) (RepositorySpec, error)
}
type RepositorySpecHandlers ¶
type RepositorySpecHandlers interface {
Register(hdlr RepositorySpecHandler, types ...string)
Copy() RepositorySpecHandlers
MapUniformRepositorySpec(ctx Context, u *UniformRepositorySpec) (RepositorySpec, error)
}
func NewRepositorySpecHandlers ¶
func NewRepositorySpecHandlers() RepositorySpecHandlers
type RepositoryType ¶
type RepositoryType interface {
runtime.VersionedTypedObjectType[RepositorySpec]
}
type RepositoryTypeProvider ¶ added in v0.3.0
type RepositoryTypeProvider = runtime.KnownTypesProvider[RepositorySpec, RepositoryType]
type RepositoryTypeScheme ¶
type RepositoryTypeScheme interface {
runtime.TypeScheme[RepositorySpec, RepositoryType]
}
func NewRepositoryTypeScheme ¶
func NewRepositoryTypeScheme(defaultDecoder RepositorySpecDecoder, base ...RepositoryTypeScheme) RepositoryTypeScheme
type UniformRepositorySpec ¶
type UniformRepositorySpec struct {
// Type
Type string `json:"type,omitempty"`
// Scheme
Scheme string `json:"scheme,omitempty"`
// Host is the hostname of an oci ref.
Host string `json:"host,omitempty"`
// Info is the file path used to host ctf component versions
Info string `json:"filePath,omitempty"`
// CreateIfMissing indicates whether a file based or dynamic repo should be created if it does not exist
CreateIfMissing bool `json:"createIfMissing,omitempty"`
// TypeHint should be set if CreateIfMissing is true to help to decide what kind of repo to create
TypeHint string `json:"typeHint,omitempty"`
}
UniformRepositorySpec is a generic specification of the repository for handling as part of standard references.
func UniformRepositorySpecForHostURL ¶
func UniformRepositorySpecForHostURL(typ string, host string) *UniformRepositorySpec
func UniformRepositorySpecForUnstructured ¶
func UniformRepositorySpecForUnstructured(un *runtime.UnstructuredVersionedTypedObject) *UniformRepositorySpec
func (*UniformRepositorySpec) ComposeRef ¶
func (u *UniformRepositorySpec) ComposeRef(art string) string
ComposeRef joins the actual repository spec and a given artifact spec.
func (*UniformRepositorySpec) CredHost ¶
func (u *UniformRepositorySpec) CredHost() string
CredHost fallback to legacy docker domain if applicable this is how containerd translates the old domain for DockerHub to the new one, taken from containerd/reference/docker/reference.go:674.
func (*UniformRepositorySpec) HostPort ¶
func (u *UniformRepositorySpec) HostPort() (string, string)
func (*UniformRepositorySpec) RepositoryRef ¶
func (u *UniformRepositorySpec) RepositoryRef() string
func (*UniformRepositorySpec) String ¶
func (u *UniformRepositorySpec) String() string
type UnknownRepositorySpec ¶
type UnknownRepositorySpec struct {
runtime.UnstructuredVersionedTypedObject `json:",inline"`
}
func (*UnknownRepositorySpec) IsUnknown ¶ added in v0.3.0
func (r *UnknownRepositorySpec) IsUnknown() bool
func (*UnknownRepositorySpec) Name ¶
func (r *UnknownRepositorySpec) Name() string
func (*UnknownRepositorySpec) Repository ¶
func (r *UnknownRepositorySpec) Repository(Context, credentials.Credentials) (Repository, error)
func (*UnknownRepositorySpec) UniformRepositorySpec ¶
func (r *UnknownRepositorySpec) UniformRepositorySpec() *UniformRepositorySpec