Documentation ¶
Overview ¶
Package repository provides a read-only implementation of an ocm repository.
The repository enables 2 primary usage scenarios:
- Using a directory within the file system as an ocm repository. This is especially convenient for local test scenarios.
- Using a list of component descriptors available in your program as an ocm repository. This has several potential usage scenarios. In the landscaper, its primary use case is to convert (potentially a tree of) component descriptors provided as inline component descriptors in the installation to an ocm repository, so this special scenario can be treated exactly the same afterwards.
To support a wide range of use cases, the internalspec allows to specify:
- A file system within which the component descriptors are stored (FileSystem).
- A path within that file system to specify the directory within which the component descriptors are stored (CompDescDirPath).
- A file system within which the blobs described by the resources of the component descriptors are stored (BlobFs).
- A path within the file system to specify the directory within which the blobs are stored (BlobDirPath).
- A mode which currently can be either "filesystem" or "context". This mode is only relevant if no dedicated blob file system (BlobFs) has been specified (and will be ignored otherwise). The default mode is "filesystem" which simply means that the blobs are located in the same file system as the component descriptors (thus, BlobFs = FileSystem). "context" means that the blob file system will be read from the ocm library context. The repository supports a specification type "inline" (see corresponding package) that allows to specify component descriptors inline (through interpreting yaml as file system - not the same as landscaper inline component descriptors!). To be able to describe artifacts that reside in the local file system in that inline component descriptor you can specify that the blob file system shall be taken from the ocmlib context. So the application can decide where local artifacts described in inline component descriptors are read from by setting this context attribute (vfsattr).
Index ¶
- Constants
- func NewRepository(ctx cpi.Context, provider ComponentDescriptorProvider, blobfs vfs.FileSystem) (cpi.Repository, error)
- type ComponentAccess
- func (a *ComponentAccess) Close() error
- func (a *ComponentAccess) ComponentLister() cpi.ComponentLister
- func (a *ComponentAccess) ExistsComponentVersion(name string, version string) (bool, error)
- func (a *ComponentAccess) GetComponentVersion(comp, version string) (virtual.VersionAccess, error)
- func (a *ComponentAccess) Index() error
- func (a *ComponentAccess) IsReadOnly() bool
- func (a *ComponentAccess) ListVersions(comp string) ([]string, error)
- func (a *ComponentAccess) SetReadOnly()
- type ComponentDescriptorProvider
- type ComponentVersionAccess
- func (v *ComponentVersionAccess) AddBlob(blob cpi.BlobAccess) (string, error)
- func (v *ComponentVersionAccess) Close() error
- func (v *ComponentVersionAccess) GetBlob(name string) (cpi.DataAccess, error)
- func (v *ComponentVersionAccess) GetDescriptor() *compdesc.ComponentDescriptor
- func (v *ComponentVersionAccess) GetInexpensiveContentVersionIdentity(a cpi.AccessSpec) string
- func (v *ComponentVersionAccess) IsReadOnly() bool
- func (a *ComponentVersionAccess) SetReadOnly()
- func (v *ComponentVersionAccess) Update() error
- type FilesystemCompDescProvider
- type Index
- type MemoryCompDescProvider
- type RepositorySpec
Constants ¶
View Source
const ( FILESYSTEM = "filesystem" CONTEXT = "context" )
View Source
const ( LocalType = "local" InlineType = "inline" )
Variables ¶
This section is empty.
Functions ¶
func NewRepository ¶
func NewRepository(ctx cpi.Context, provider ComponentDescriptorProvider, blobfs vfs.FileSystem) (cpi.Repository, error)
Types ¶
type ComponentAccess ¶
type ComponentAccess struct {
// contains filtered or unexported fields
}
func NewAccess ¶
func NewAccess(descriptorProvider ComponentDescriptorProvider, blobFs vfs.FileSystem) (*ComponentAccess, error)
func (*ComponentAccess) Close ¶
func (a *ComponentAccess) Close() error
func (*ComponentAccess) ComponentLister ¶
func (a *ComponentAccess) ComponentLister() cpi.ComponentLister
func (*ComponentAccess) ExistsComponentVersion ¶
func (a *ComponentAccess) ExistsComponentVersion(name string, version string) (bool, error)
func (*ComponentAccess) GetComponentVersion ¶
func (a *ComponentAccess) GetComponentVersion(comp, version string) (virtual.VersionAccess, error)
func (*ComponentAccess) Index ¶
func (a *ComponentAccess) Index() error
Index adds all Component Descriptors in the descriptorProvider to the Repository Index (in other words, it makes them known to the repository). This function used to initialize the repository but can also be used to update the repository in case Component Descriptors were added to the descriptorProvider.
func (*ComponentAccess) IsReadOnly ¶
func (a *ComponentAccess) IsReadOnly() bool
func (*ComponentAccess) ListVersions ¶
func (a *ComponentAccess) ListVersions(comp string) ([]string, error)
func (*ComponentAccess) SetReadOnly ¶ added in v0.106.0
func (a *ComponentAccess) SetReadOnly()
type ComponentDescriptorProvider ¶
type ComponentDescriptorProvider interface {
List() ([]*compdesc.ComponentDescriptor, error)
}
func NewFilesystemCompDescProvider ¶
func NewFilesystemCompDescProvider(path string, fs ...vfs.FileSystem) ComponentDescriptorProvider
func NewMemoryCompDescProvider ¶
func NewMemoryCompDescProvider(descriptors []*compdesc.ComponentDescriptor) ComponentDescriptorProvider
type ComponentVersionAccess ¶
type ComponentVersionAccess struct {
// contains filtered or unexported fields
}
func (*ComponentVersionAccess) AddBlob ¶
func (v *ComponentVersionAccess) AddBlob(blob cpi.BlobAccess) (string, error)
func (*ComponentVersionAccess) Close ¶
func (v *ComponentVersionAccess) Close() error
func (*ComponentVersionAccess) GetBlob ¶
func (v *ComponentVersionAccess) GetBlob(name string) (cpi.DataAccess, error)
func (*ComponentVersionAccess) GetDescriptor ¶
func (v *ComponentVersionAccess) GetDescriptor() *compdesc.ComponentDescriptor
func (*ComponentVersionAccess) GetInexpensiveContentVersionIdentity ¶
func (v *ComponentVersionAccess) GetInexpensiveContentVersionIdentity(a cpi.AccessSpec) string
func (*ComponentVersionAccess) IsReadOnly ¶
func (v *ComponentVersionAccess) IsReadOnly() bool
func (*ComponentVersionAccess) SetReadOnly ¶ added in v0.106.0
func (a *ComponentVersionAccess) SetReadOnly()
func (*ComponentVersionAccess) Update ¶
func (v *ComponentVersionAccess) Update() error
type FilesystemCompDescProvider ¶
type FilesystemCompDescProvider struct { CompDescFs vfs.FileSystem CompDescDirPath string }
func (*FilesystemCompDescProvider) List ¶
func (f *FilesystemCompDescProvider) List() ([]*compdesc.ComponentDescriptor, error)
type MemoryCompDescProvider ¶
type MemoryCompDescProvider struct {
CompDescs []*compdesc.ComponentDescriptor
}
func (*MemoryCompDescProvider) List ¶
func (m *MemoryCompDescProvider) List() ([]*compdesc.ComponentDescriptor, error)
type RepositorySpec ¶
type RepositorySpec struct { runtime.InternalVersionedTypedObject[cpi.RepositorySpec] FileSystem vfs.FileSystem CompDescDirPath string BlobFs vfs.FileSystem BlobFsMode string BlobDirPath string }
func (*RepositorySpec) AsUniformSpec ¶
func (r *RepositorySpec) AsUniformSpec(ctx cpi.Context) *cpi.UniformRepositorySpec
func (*RepositorySpec) Key ¶
func (r *RepositorySpec) Key() (string, error)
func (RepositorySpec) MarshalJSON ¶
func (r RepositorySpec) MarshalJSON() ([]byte, error)
func (*RepositorySpec) Repository ¶
func (r *RepositorySpec) Repository(ctx cpi.Context, creds credentials.Credentials) (cpi.Repository, error)
Directories ¶
Path | Synopsis |
---|---|
Package inline defines a repository type "inline", that allows to include the whole repository in its specification through interpreting yaml as file system.
|
Package inline defines a repository type "inline", that allows to include the whole repository in its specification through interpreting yaml as file system. |
Package local defines a repository type "local", that resembles the legacy implementation for interpreting directories as ocm repositories.
|
Package local defines a repository type "local", that resembles the legacy implementation for interpreting directories as ocm repositories. |
Click to show internal directories.
Click to hide internal directories.