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 Duration
- 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
- func (s *GenericRepositorySpec) Validate(ctx Context, creds credentials.Credentials, ...) error
- type HTTPSettings
- 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
- func (u *UniformRepositorySpec) ComposeRef(art string) string
- func (u *UniformRepositorySpec) CredHost() string
- func (u *UniformRepositorySpec) HostPort() (string, string)
- func (u *UniformRepositorySpec) RepositoryRef() string
- func (u *UniformRepositorySpec) SetType(typ string)
- func (u *UniformRepositorySpec) String() string
- type UnknownRepositorySpec
- func (r *UnknownRepositorySpec) IsUnknown() bool
- func (r *UnknownRepositorySpec) Name() string
- func (r *UnknownRepositorySpec) Repository(Context, credentials.Credentials) (Repository, error)
- func (r *UnknownRepositorySpec) UniformRepositorySpec() *UniformRepositorySpec
- func (r *UnknownRepositorySpec) Validate(Context, credentials.Credentials, ...credentials.UsageContext) error
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 ¶
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 ¶
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 ¶
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 ¶
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)
RepositorySpecForConfig(data []byte, unmarshaler runtime.Unmarshaler) (RepositorySpec, error)
GetAlias(name string) RepositorySpec
SetAlias(name string, spec RepositorySpec)
GetHTTPSettings() (HTTPSettings, error)
SetHTTPSettings(s *HTTPSettings)
}
func ForContext ¶
ForContext returns the Context to use for context.Context. This is either an explicit context or the default context.
func FromProvider ¶
func FromProvider(p ContextProvider) Context
type ContextProvider ¶
type ContextProvider interface {
OCIContext() Context
}
type DataAccess ¶
type DataAccess = blobaccess.DataAccess
type Duration ¶ added in v0.41.0
Duration is a time.Duration that marshals to/from a human-readable Go duration string (e.g. "30s", "5m") in JSON/YAML.
func (Duration) MarshalJSON ¶ added in v0.41.0
MarshalJSON implements the json.Marshaler interface. It encodes the Duration as a quoted Go duration string (e.g. "30s", "1h5m").
func (*Duration) UnmarshalJSON ¶ added in v0.41.0
UnmarshalJSON implements the json.Unmarshaller interface. It parses a quoted Go duration string (e.g. "30s", "1h5m") into a Duration.
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
func (*GenericRepositorySpec) Validate ¶
func (s *GenericRepositorySpec) Validate(ctx Context, creds credentials.Credentials, context ...credentials.UsageContext) error
type HTTPSettings ¶ added in v0.41.0
type HTTPSettings struct {
// Timeout is the overall http.Client timeout -- the maximum duration
// for the entire request including connection, TLS, headers, and body.
// It does NOT serve as a fallback for transport-level timeouts.
// If not set, http.Client uses no timeout (0).
Timeout *Duration `json:"timeout,omitempty"`
// TCPDialTimeout is the time limit for establishing a TCP connection.
TCPDialTimeout *Duration `json:"tcpDialTimeout,omitempty"`
// TCPKeepAlive is the interval between TCP keep-alive probes.
// If zero, probes are sent with a default value (currently 15 seconds).
// If negative, keep-alive probes are disabled.
TCPKeepAlive *Duration `json:"tcpKeepAlive,omitempty"`
// TLSHandshakeTimeout is the maximum time to wait for a TLS handshake.
TLSHandshakeTimeout *Duration `json:"tlsHandshakeTimeout,omitempty"`
// ResponseHeaderTimeout is the time limit to wait for response headers.
ResponseHeaderTimeout *Duration `json:"responseHeaderTimeout,omitempty"`
// IdleConnTimeout is the maximum time an idle connection remains open.
IdleConnTimeout *Duration `json:"idleConnTimeout,omitempty"`
}
HTTPSettings contains the timeout settings for HTTP clients. All timeout values use Duration (Go duration strings in config). If not set (nil), the http.DefaultTransport value from the Go standard library is used.
Note: Timeout controls the overall http.Client deadline and is independent of the transport-level timeouts below. Setting Timeout alone does NOT override TCPDialTimeout, TLSHandshakeTimeout, etc.
func (*HTTPSettings) Validate ¶ added in v0.41.0
func (s *HTTPSettings) Validate() error
Validate checks that timeout values are non-negative. TCPKeepAlive is not validated because any negative value disables keep-alive probes (consistent with Go's net.Dialer.KeepAlive).
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)
Modify(func(manifest *artdesc.Manifest) error) error
SetConfigBlob(blob BlobAccess, d *artdesc.Descriptor) error
}
type NamespaceAccess ¶
type NamespaceAccess interface {
resource.ResourceView[NamespaceAccess]
NamespaceAccessImpl
}
type NamespaceAccessImpl ¶
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 ¶
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)
Validate(Context, credentials.Credentials, ...credentials.UsageContext) error
}
func CreateRepositorySpec ¶
func CreateRepositorySpec(t runtime.TypedObject) (RepositorySpec, error)
func NewGenericRepositorySpec ¶
func NewGenericRepositorySpec(data []byte, unmarshaler runtime.Unmarshaler) (RepositorySpec, error)
type RepositorySpecDecoder ¶
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 ¶
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:"info,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) SetType ¶
func (u *UniformRepositorySpec) SetType(typ string)
func (*UniformRepositorySpec) String ¶
func (u *UniformRepositorySpec) String() string
type UnknownRepositorySpec ¶
type UnknownRepositorySpec struct {
runtime.UnstructuredVersionedTypedObject `json:",inline"`
}
func (*UnknownRepositorySpec) IsUnknown ¶
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
func (*UnknownRepositorySpec) Validate ¶
func (r *UnknownRepositorySpec) Validate(Context, credentials.Credentials, ...credentials.UsageContext) error