cache

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Overview

Package cache implements the plugin cache that contains all loaded plugins. It keeps the metadata for the various discovered plugins and provides a Go abstraction to call the appropriate commands.

Index

Constants

This section is empty.

Variables

View Source
var DirectoryCache = &pluginDirCache{
	directories: map[string]PluginDir{},
}

Functions

func Exec

func Exec(execpath string, config json.RawMessage, r io.Reader, w io.Writer, args ...string) ([]byte, error)

func GetCachedPluginInfo added in v0.12.0

func GetCachedPluginInfo(dir string, name string) (*descriptor.Descriptor, error)

func GetPluginInfo

func GetPluginInfo(execpath string) (*descriptor.Descriptor, error)

func RemoveFile

func RemoveFile(file string) error

func RemovePluginSource

func RemovePluginSource(dir string, name string) error

func SetPluginSourceInfo added in v0.12.0

func SetPluginSourceInfo(dir string, cv ocm.ComponentVersionAccess, rsc, name string) error

Types

type ConstraintRegistry

type ConstraintRegistry[T any, K registry.Key[K]] struct {
	// contains filtered or unexported fields
}

func NewConstraintRegistry

func NewConstraintRegistry[T descriptor.Element[K], K registry.Key[K]](list []T) *ConstraintRegistry[T, K]

func (*ConstraintRegistry[T, K]) Lookup

func (r *ConstraintRegistry[T, K]) Lookup(key K) []*T

func (*ConstraintRegistry[T, K]) LookupFor

func (r *ConstraintRegistry[T, K]) LookupFor(name string, key K) []*T

func (*ConstraintRegistry[T, K]) LookupKeys

func (r *ConstraintRegistry[T, K]) LookupKeys(key K) set.Set[K]

func (*ConstraintRegistry[T, K]) LookupKeysFor

func (r *ConstraintRegistry[T, K]) LookupKeysFor(name string, key K) set.Set[K]

type Plugin

type Plugin = *pluginImpl

func NewPlugin

func NewPlugin(name string, path string, desc *descriptor.Descriptor, errmsg string) Plugin

type PluginDir

type PluginDir = *pluginDirImpl

func Get

func Get(path string) PluginDir

func NewDir

func NewDir(path string) PluginDir

type PluginDirCache

type PluginDirCache = *pluginDirCache

type PluginInfo added in v0.12.0

type PluginInfo struct {
	Size       int64                  `json:"size,omitempty"`
	ModTime    time.Time              `json:"modtime,omitempty"`
	Descriptor *descriptor.Descriptor `json:"descriptor,omitempty"`
}

type PluginInstallationInfo added in v0.12.0

type PluginInstallationInfo struct {
	PluginSourceInfo `json:",inline"`
	PluginInfo       *PluginInfo `json:"info,omitempty"`
}

func (*PluginInstallationInfo) HasPluginInfo added in v0.12.0

func (p *PluginInstallationInfo) HasPluginInfo() bool

func (*PluginInstallationInfo) HasSourceInfo added in v0.12.0

func (p *PluginInstallationInfo) HasSourceInfo() bool

func (*PluginInstallationInfo) IsValidPluginInfo added in v0.12.0

func (p *PluginInstallationInfo) IsValidPluginInfo(execpath string) bool

func (*PluginInstallationInfo) UpdatePluginInfo added in v0.12.0

func (p *PluginInstallationInfo) UpdatePluginInfo(execpath string) (bool, error)

type PluginSourceInfo added in v0.12.0

type PluginSourceInfo struct {
	Repository *cpi.GenericRepositorySpec `json:"repository,omitempty"`
	Component  string                     `json:"component,omitempty"`
	Version    string                     `json:"version,omitempty"`
	Resource   string                     `json:"resource,omitempty"`
}

func (*PluginSourceInfo) GetDescription added in v0.12.0

func (p *PluginSourceInfo) GetDescription() string

func (*PluginSourceInfo) HasSourceInfo added in v0.12.0

func (p *PluginSourceInfo) HasSourceInfo() bool

type PluginUpdater

type PluginUpdater struct {
	Context     ocm.Context
	Force       bool
	RemoveMode  bool
	UpdateMode  bool
	Describe    bool
	Constraints []*semver.Constraints

	Current string
	Printer common.Printer
}

func NewPluginUpdater

func NewPluginUpdater(ctx ocm.ContextProvider, printer common.Printer) *PluginUpdater

func (*PluginUpdater) DownloadFromRepo

func (o *PluginUpdater) DownloadFromRepo(session ocm.Session, repo ocm.Repository, ref, name string) error

func (*PluginUpdater) DownloadRef

func (o *PluginUpdater) DownloadRef(session ocm.Session, ref string, name string) error

func (*PluginUpdater) Remove

func (o *PluginUpdater) Remove(session ocm.Session, name string) error

func (*PluginUpdater) Update

func (o *PluginUpdater) Update(session ocm.Session, name string) error

Jump to

Keyboard shortcuts

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