Documentation
¶
Index ¶
- func AddToLocalCache(fs vfs.FileSystem, cd *cdv2.ComponentDescriptor) error
- func GetOCIRepositoryContext(repoCtx cdv2.Repository) (cdv2.OCIRegistryRepository, error)
- func LocalCachePath(repoCtx cdv2.OCIRegistryRepository, name, version string) string
- func OCIRef(repository cdv2.Repository, name, version string) (string, error)
- func ResolveInLocalCache(fs vfs.FileSystem, repoCtx cdv2.OCIRegistryRepository, name, version string, ...) (*cdv2.ComponentDescriptor, error)
- type LocalComponentCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddToLocalCache ¶
func AddToLocalCache(fs vfs.FileSystem, cd *cdv2.ComponentDescriptor) error
AddToLocalCache stores the given filesystem in the local cache. The local cache is expected to have its root at $COMPONENT_REPOSITORY_CACHE_DIR. In the root directory each repository context has its own directory, whereas the directory name is $baseurl.replace("/", "-"). Inside the repository context a component descriptor is cached under $component-name + "-" + $component-version
E.g. Given COMPONENT_REPOSITORY_CACHE_DIR="/component-cache";baseUrl="eu.gcr.io/my-context/dev"; component-name="github.com/openmcp-project/landscaper/legacy-component-cli"; component-version="v0.1.0" results in the path "/component-cache/eu.gcr.io-my-context-dev/github.com/openmcp-project/landscaper/legacy-component-cli-v0.1.0"
func GetOCIRepositoryContext ¶
func GetOCIRepositoryContext(repoCtx cdv2.Repository) (cdv2.OCIRegistryRepository, error)
GetOCIRepositoryContext returns a OCIRegistryRepository from a repository
func LocalCachePath ¶
func LocalCachePath(repoCtx cdv2.OCIRegistryRepository, name, version string) string
LocalCachePath returns the filepath for a component defined by its repository context, name and version.
func OCIRef ¶
func OCIRef(repository cdv2.Repository, name, version string) (string, error)
OCIRef wraps the componentspec provided OciRef function by exposing the cdv2.Repository interface that is automatically parsed to a oci registry.
func ResolveInLocalCache ¶
func ResolveInLocalCache(fs vfs.FileSystem, repoCtx cdv2.OCIRegistryRepository, name, version string, decodeOpts ...codec.DecodeOption) (*cdv2.ComponentDescriptor, error)
ResolveInLocalCache resolves a component descriptor from a local cache. The local cache is expected to have its root at $COMPONENT_REPOSITORY_CACHE_DIR. In the root directory each repository context has its own directory, whereas the directory name is $baseurl.replace("/", "-"). Inside the repository context a component descriptor is cached under $component-name + "-" + $component-version
E.g. Given COMPONENT_REPOSITORY_CACHE_DIR="/component-cache";baseUrl="eu.gcr.io/my-context/dev"; component-name="github.com/openmcp-project/landscaper/legacy-component-cli"; component-version="v0.1.0" results in the path "/component-cache/eu.gcr.io-my-context-dev/github.com/openmcp-project/landscaper/legacy-component-cli-v0.1.0"
Types ¶
type LocalComponentCache ¶
type LocalComponentCache struct {
// contains filtered or unexported fields
}
LocalComponentCache implements a components oci cache for local files
func NewLocalComponentCache ¶
func NewLocalComponentCache(fs vfs.FileSystem, decodeOpts ...codec.DecodeOption) *LocalComponentCache
NewLocalComponentCache creates a new component cache that caches components on a filesystem.
func (LocalComponentCache) Get ¶
func (l LocalComponentCache) Get(ctx context.Context, repoCtx cdv2.OCIRegistryRepository, name, version string) (*cdv2.ComponentDescriptor, error)
func (LocalComponentCache) Store ¶
func (l LocalComponentCache) Store(ctx context.Context, descriptor *cdv2.ComponentDescriptor) error