repository

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigurationKey       = "configuration"
	ConfigurationSchemaKey = "configuration_schema"
)

Variables

View Source
var (
	ErrInvalidAnnotations = errors.New("invalid annotations")
	ErrInvalidOptions     = errors.New("invalid options")
)

Functions

This section is empty.

Types

type Annotations

type Annotations map[string]interface{}

Annotations is a json object. Any data you want it attach on.

type Constructor

type Constructor func(connectInfo *Info, args ...interface{}) (Repository, error)

Constructor return new repository.

type DestroyPlugin

type DestroyPlugin func(pluginID string) error

DestroyPlugin destroy model.Plugin.

type Info

type Info struct {
	Name        string      `json:"name"`                  // repository name.
	URL         string      `json:"url"`                   // repository url.
	Annotations Annotations `json:"annotations,omitempty"` // repository annotations.
}

Info repository information.

func NewInfo

func NewInfo(name, url string, annotations Annotations) *Info

func (*Info) String

func (i *Info) String() string

type InfoOperator

type InfoOperator interface {
	// Create plugin repo.
	Create(context.Context, *Info) error
	// Get plugin repo info with the repo name.
	Get(ctx context.Context, repoName string) (*Info, error)
	// Delete plugin repo with the repo name.
	Delete(ctx context.Context, repoName string) (*Info, error)
	// List all plugin repo.
	List(ctx context.Context) ([]*Info, error)
	// Watch plugin repo map change. parameter is the changed data.
	Watch(ctx context.Context, interval string, callback func(news, updates, deletes []*Info) error) error
}

InfoOperator manager repository information operator.

type Installer

type Installer interface {
	// SetPluginID set plugin id after installing to tKeel.
	SetPluginID(pluginID string)
	// Annotations get annotations. custom data. Return a copy of the Annotations.
	Annotations() Annotations
	// Options get installer options.
	Options() []*Option
	// SetOption set option to Installer.
	SetOption(...*Option) error
	// Install plugin.
	Install(opts ...*Option) error
	// Upgrade plugin.
	Upgrade(opts ...*Option) error
	// Uninstall plugin.
	Uninstall() error
	// Brief get installer brief information.
	Brief() *InstallerBrief
}

Installer plugin installer.

type InstallerBrief

type InstallerBrief struct {
	Name            string            `json:"name"`
	Repo            string            `json:"repo"`
	Version         string            `json:"version"`
	State           InstallerState    `json:"state"`
	Desc            string            `json:"desc"`
	Maintainers     []*Maintainer     `json:"maintainers"`
	Annotations     map[string]string `json:"annotations"`
	CreateTimestamp int64             `json:"create_timestamp"`
	Icon            string            `json:"icon"`
	VersionList     []*pb.VersionList `json:"version_list"`
}

InstallerBrief installer brief information.

func (*InstallerBrief) String

func (ib *InstallerBrief) String() string

type InstallerState added in v0.4.0

type InstallerState int32
const (
	StateUninstall         InstallerState = 0
	StateInstalled         InstallerState = 1
	StateSameNameInstalled InstallerState = 2
)

type Maintainer added in v0.4.0

type Maintainer struct {
	Name  string `json:"name"`
	URL   string `json:"url"`
	Email string `json:"email"`
}

type Option

type Option struct {
	Key   string      `json:"key"`
	Value interface{} `json:"value"`
}

Option key and value.

type Repository

type Repository interface {
	// Info get repository information.
	Info() *Info
	// Search for installers whose names match words. * match all installers.
	Search(word string) ([]*InstallerBrief, error)
	// Get the installer with matching name and version.
	Get(name, version string) (Installer, error)
	// Installed find installed installer(contains installation packages that have been deleted in the repository).
	Installed() ([]Installer, error)
	// Update update repository installer.return whether updated.
	Update() (bool, error)
	// Len get all installer number.
	Len() int
	// Close this repository.
	Close() error
}

Repository plugin installer repository.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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