comparch

package
v2.0.0-...-98cc131 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

README

Repository ComponentArchive - Filesystem based Storage of a Component Version

Synopsis
type: ComponentArchive/v1
Description

The content of a single OCM Component Version will be stored as Filesystem content. This is a special version of an OCM Repository, which can be used to compose a component version during the build time of a component.

Supported specification version is v1.

Specification Versions
Version v1

The type specific specification fields are:

  • filePath string

    Path in filesystem used to host the repository.

  • fileFormat (optional) string

    The format to use to store content:

    • directory: stored as directory structure
    • tar: stored as directory structure in a tar file
    • tgz: stored as directory structure in a tar file compressed by GNU Zip
Go Bindings

The Go binding can be found here.

Documentation

Index

Constants

View Source
const (
	Type   = "ComponentArchive"
	TypeV1 = Type + runtime.VersionSeparator + "v1"
)
View Source
const BlobsDirectoryName = "blobs"

BlobsDirectoryName is the name of the blob directory in the tar.

View Source
const ComponentDescriptorFileName = compdesc.ComponentDescriptorFileName

ComponentDescriptorFileName is the name of the component-descriptor file.

Variables

Functions

func GetFormats

func GetFormats() []string

func NewRepository

func NewRepository(ctx cpi.Context, s *RepositorySpec) (cpi.Repository, error)

func NewStateHandler

func NewStateHandler(fs vfs.FileSystem) accessobj.StateHandler

func RegisterFormat

func RegisterFormat(f accessobj.FormatHandler) *formatHandler

Types

type BlobSink

type BlobSink struct {
	Sink ocicpi.BlobSink
}

func (*BlobSink) AddBlob

func (s *BlobSink) AddBlob(blob accessio.BlobAccess) (string, error)

type ComponentAccessImpl

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

func (*ComponentAccessImpl) AddVersion

func (c *ComponentAccessImpl) AddVersion(access cpi.ComponentVersionAccess) error

func (*ComponentAccessImpl) HasVersion

func (c *ComponentAccessImpl) HasVersion(vers string) (bool, error)

func (*ComponentAccessImpl) ListVersions

func (c *ComponentAccessImpl) ListVersions() ([]string, error)

func (*ComponentAccessImpl) LookupVersion

func (c *ComponentAccessImpl) LookupVersion(ref string) (cpi.ComponentVersionAccess, error)

func (*ComponentAccessImpl) NewVersion

func (c *ComponentAccessImpl) NewVersion(version string, overrides ...bool) (cpi.ComponentVersionAccess, error)

type ComponentArchive

type ComponentArchive struct {
	cpi.ComponentVersionAccess
	// contains filtered or unexported fields
}

ComponentArchive is the go representation for a component artifact.

func New

New returns a new representation based element.

func (*ComponentArchive) Close

func (c *ComponentArchive) Close() error

func (*ComponentArchive) Repository

func (c *ComponentArchive) Repository() cpi.Repository

func (*ComponentArchive) SetName

func (c *ComponentArchive) SetName(n string)

func (*ComponentArchive) SetVersion

func (c *ComponentArchive) SetVersion(v string)

type FormatHandler

type FormatHandler interface {
	accessio.Option

	Format() accessio.FileFormat

	Open(ctx cpi.ContextProvider, acc accessobj.AccessMode, path string, opts accessio.Options) (*Object, error)
	Create(ctx cpi.ContextProvider, path string, opts accessio.Options, mode vfs.FileMode) (*Object, error)
	Write(obj *Object, path string, opts accessio.Options, mode vfs.FileMode) error
}

func GetFormat

func GetFormat(name accessio.FileFormat) FormatHandler

type Object

type Object = ComponentArchive

func Create

func Create(ctx cpi.ContextProvider, acc accessobj.AccessMode, path string, mode vfs.FileMode, opts ...accessio.Option) (*Object, error)

func Open

func Open(ctx cpi.ContextProvider, acc accessobj.AccessMode, path string, mode vfs.FileMode, opts ...accessio.Option) (*Object, error)

type RepositoryImpl

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

func (*RepositoryImpl) ComponentLister

func (r *RepositoryImpl) ComponentLister() cpi.ComponentLister

func (*RepositoryImpl) ExistsComponentVersion

func (r *RepositoryImpl) ExistsComponentVersion(name string, ref string) (bool, error)

func (*RepositoryImpl) Get

func (r *RepositoryImpl) Get() *ComponentArchive

func (*RepositoryImpl) GetComponents

func (r *RepositoryImpl) GetComponents(prefix string, closure bool) ([]string, error)

func (*RepositoryImpl) GetSpecification

func (r *RepositoryImpl) GetSpecification() cpi.RepositorySpec

func (*RepositoryImpl) LookupComponent

func (r *RepositoryImpl) LookupComponent(name string) (cpi.ComponentAccess, error)

func (*RepositoryImpl) LookupComponentVersion

func (r *RepositoryImpl) LookupComponentVersion(name string, version string) (cpi.ComponentVersionAccess, error)

func (*RepositoryImpl) NumComponents

func (r *RepositoryImpl) NumComponents(prefix string) (int, error)

type RepositorySpec

type RepositorySpec struct {
	runtime.ObjectVersionedType `json:",inline"`
	accessio.StandardOptions    `json:",omitempty"`

	// FileFormat is the format of the repository file
	FilePath string `json:"filePath"`
	// AccessMode can be set to request readonly access or creation
	AccessMode accessobj.AccessMode `json:"accessMode,omitempty"`
}

func NewRepositorySpec

func NewRepositorySpec(acc accessobj.AccessMode, filePath string, opts ...accessio.Option) (*RepositorySpec, error)

NewRepositorySpec creates a new RepositorySpec.

func (*RepositorySpec) AsUniformSpec

func (a *RepositorySpec) AsUniformSpec(cpi.Context) *cpi.UniformRepositorySpec

func (*RepositorySpec) GetType

func (a *RepositorySpec) GetType() string

func (*RepositorySpec) IsIntermediate

func (a *RepositorySpec) IsIntermediate() bool

func (*RepositorySpec) Repository

func (a *RepositorySpec) Repository(ctx cpi.Context, creds credentials.Credentials) (cpi.Repository, error)

type StateHandler

type StateHandler struct{}

func (StateHandler) Decode

func (i StateHandler) Decode(data []byte) (interface{}, error)

func (StateHandler) Encode

func (i StateHandler) Encode(d interface{}) ([]byte, error)

func (StateHandler) Equivalent

func (i StateHandler) Equivalent(a, b interface{}) bool

func (StateHandler) Initial

func (i StateHandler) Initial() interface{}

Jump to

Keyboard shortcuts

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