componentresolvers

package
v0.104.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const ComponentArchiveRepositoryType = "ComponentArchive"

ComponentArchiveRepositoryType defines an alternative local repository context type that can also be handled by this implementation

View Source
const FilesystemBlobType = "filesystemBlob"

FilesystemBlobType is the access type of a blob that is located in a filesystem.

View Source
const LocalRepositoryType = "local"

LocalRepositoryType defines the local repository context type.

Variables

This section is empty.

Functions

func IsLocalType

func IsLocalType(typ string) bool

func NewLocalFilesystemBlobAccess

func NewLocalFilesystemBlobAccess(path, mediaType string) (cdv2.UnstructuredTypedObject, error)

func NewLocalRepositoryContext

func NewLocalRepositoryContext(baseURL string) (cdv2.UnstructuredTypedObject, error)

func NewOCIRegistryAccess

func NewOCIRegistryAccess(ociImageRef string) (cdv2.UnstructuredTypedObject, error)

func NewOCIRepositoryContext

func NewOCIRepositoryContext(baseURL string) (cdv2.UnstructuredTypedObject, error)

Types

type BaseFilesystemBlobResolver

type BaseFilesystemBlobResolver struct {
	// contains filtered or unexported fields
}

BaseFilesystemBlobResolver implements a common method for filesystem.

func (*BaseFilesystemBlobResolver) ResolveFromFs

func (res *BaseFilesystemBlobResolver) ResolveFromFs(blobpath string) (*ctf.BlobInfo, io.ReadCloser, error)

ResolveFromFs resolves a blob from a given path.

type BlueprintResolver

type BlueprintResolver struct {
	// contains filtered or unexported fields
}

BlueprintResolver is a blob resolver that can resolve blueprints that are defined as their independent oci artifact.

func (BlueprintResolver) CanResolve

func (b BlueprintResolver) CanResolve(res types.Resource) bool

func (*BlueprintResolver) Info

func (*BlueprintResolver) Resolve

func (b *BlueprintResolver) Resolve(ctx context.Context, res types.Resource, writer io.Writer) (*ctf.BlobInfo, error)

type FilesystemBlobAccess

type FilesystemBlobAccess struct {
	cdv2.ObjectType `json:",inline"`
	// Path to the file on the filesystem
	Path string `json:"filename"`
}

FilesystemBlobAccess describes the access for a blob on the filesystem.

func NewFilesystemBlobAccess

func NewFilesystemBlobAccess(path string) *FilesystemBlobAccess

NewFilesystemBlobAccess creates a new localFilesystemBlob accessor.

func (FilesystemBlobAccess) GetData

func (a FilesystemBlobAccess) GetData() ([]byte, error)

func (*FilesystemBlobAccess) SetData

func (a *FilesystemBlobAccess) SetData(bytes []byte) error

type FilesystemBlobResolver

type FilesystemBlobResolver struct {
	BaseFilesystemBlobResolver
}

FilesystemBlobResolver implements the BlobResolver interface for "filesystemBlob" access types.

func (*FilesystemBlobResolver) CanResolve

func (ca *FilesystemBlobResolver) CanResolve(resource types.Resource) bool

func (*FilesystemBlobResolver) Info

func (*FilesystemBlobResolver) Resolve

func (ca *FilesystemBlobResolver) Resolve(ctx context.Context, res types.Resource, writer io.Writer) (*ctf.BlobInfo, error)

Resolve fetches the blob for a given resource and writes it to the given tar.

type LocalFilesystemBlobResolver

type LocalFilesystemBlobResolver struct {
	BaseFilesystemBlobResolver
}

LocalFilesystemBlobResolver implements the BlobResolver interface for "localFilesystemBlob" access types.

func NewLocalFilesystemBlobResolver

func NewLocalFilesystemBlobResolver(fs vfs.FileSystem) *LocalFilesystemBlobResolver

NewLocalFilesystemBlobResolver creates a new local filesystem blob resolver.

func (*LocalFilesystemBlobResolver) CanResolve

func (ca *LocalFilesystemBlobResolver) CanResolve(resource types.Resource) bool

func (*LocalFilesystemBlobResolver) Info

func (*LocalFilesystemBlobResolver) Resolve

Resolve fetches the blob for a given resource and writes it to the given tar.

type LocalRepository

type LocalRepository struct {
	cdv2.ObjectType
	BaseURL string `json:"baseUrl"`
}

LocalRepository describes a local repository

func NewLocalRepository

func NewLocalRepository(baseUrl string) *LocalRepository

NewLocalRepository creates a new local repository

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func New

func New(sharedCache cache.Cache, clients ...TypedRegistry) (*Manager, error)

New creates a ociClient that can handle multiple clients. The manager can handle a shared cache that is injected into the registries.

func (*Manager) Resolve

func (m *Manager) Resolve(ctx context.Context, repoCtx cdv2.Repository, name, version string) (*cdv2.ComponentDescriptor, error)

func (*Manager) ResolveWithBlobResolver

func (m *Manager) ResolveWithBlobResolver(ctx context.Context, repoCtx cdv2.Repository, name, version string) (*cdv2.ComponentDescriptor, ctf.BlobResolver, error)

func (*Manager) Set

func (m *Manager) Set(registries ...TypedRegistry) error

Set adds registries to the manager.

func (*Manager) SetRegistryForAlias

func (m *Manager) SetRegistryForAlias(registry TypedRegistry, alias string) error

SetRegistryForAlias enables using a specific registry implementation for a different type than its statically configured type (the type returned by registry.Type() )

func (*Manager) SharedCache

func (m *Manager) SharedCache() cache.Cache

SharedCache returns the shared cache for all managed registries. Returns nil if there is no shared cache.

type TypedRegistry

type TypedRegistry interface {
	ctf.ComponentResolver
	Type() string
}

TypedRegistry describes a registry that can handle the given type.

func NewLocalClient

func NewLocalClient(fs vfs.FileSystem, rootPath string) (TypedRegistry, error)

NewLocalClient creates a new local registry from a root.

func NewOCIRegistryWithOCIClient

func NewOCIRegistryWithOCIClient(log logging.Logger, client ociclient.Client, predefinedComponentDescriptors ...*cdv2.ComponentDescriptor) (TypedRegistry, error)

NewOCIRegistryWithOCIClient creates a new oci registry with a oci ociClient If supplied, it parses and stores predefined component descriptors.

Jump to

Keyboard shortcuts

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