model

package
v0.7.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnrecognizedRemotePath is error when remote path is not recognized
	ErrUnrecognizedRemotePath = errors.New("remote path is not recognized")
	// ErrNilAsset is error when asset is nil
	ErrNilAsset = errors.New("asset is nil")
	// ErrEmptyProvider is error when provider is empty
	ErrEmptyProvider = errors.New("provider is empty")
	// ErrNilContext is error when context is nil
	ErrNilContext = errors.New("context is nil")
	// ErrNilManifester is error when manifester is nil
	ErrNilManifester = errors.New("manifester is nil")
	// ErrNilAssetOperator is error when asset operator is nil
	ErrNilAssetOperator = errors.New("asset operator is nil")
	// ErrEmptyRemotePath is error when remote path is empty
	ErrEmptyRemotePath = errors.New("remote path is empty")
	// ErrEmptyAPIPath is error when api path is empty
	ErrEmptyAPIPath = errors.New("api path is empty")
	// ErrEmptyCommandName is error when command name is empty
	ErrEmptyCommandName = errors.New("command name is empty")
	// ErrEmptyTagName is error when tag name is empty
	ErrEmptyTagName = errors.New("tag name is empty")
)
View Source
var ExtensionDir string

ExtensionDir is directory path where to store the extensions

Functions

This section is empty.

Types

type AssetOperator

type AssetOperator interface {
	// Prepare does preparation before any operation.
	// Such preparation can be in the form of, but not limited to, creating local directory.
	Prepare(localDirPath string) error
	// Install installs an asset according to the specified tag name.
	Install(asset []byte, tagName string) error
	// Uninstall uninstalls asset specified by the tag names.
	Uninstall(tagNames ...string) error
	// Run runs extension specified by the tag name.
	// Arguments can be sent to the extension through the args parameter.
	Run(tagName string, args ...string) error
}

AssetOperator is a contract to operate on extension asset

type Client

type Client interface {
	// DownloadRelease downloads a release specified by the parameter.
	// This string parameter is not necessarily the URL path.
	// Each provider can defines what this parameter is.
	DownloadRelease(context.Context, string) (*RepositoryRelease, error)
	// DownloadAsset downloads asset based on the parameter.
	// This string parameter is not necessarily the URL path.
	// Each provider can defines what this parameter is.
	DownloadAsset(context.Context, string) ([]byte, error)
}

Client is a contract that will be defined by each provider to execute client-related operation

type Manifest

type Manifest struct {
	UpdatedAt        time.Time          `yaml:"updated_at"`
	RepositoryOwners []*RepositoryOwner `yaml:"repository_owners"`
}

Manifest describes extensions' information

type Manifester

type Manifester interface {
	Load(dirPath string) (*Manifest, error)
	Flush(manifest *Manifest, dirPath string) error
}

Manifester is a contract to operate on manifest file

type Metadata

type Metadata struct {
	ProviderName string
	OwnerName    string
	ProjectName  string
	TagName      string

	CurrentAPIPath string
	UpgradeAPIPath string
	LocalDirPath   string

	CommandName string
}

Metadata defines general metadata for an extension

type Parser

type Parser func(remotePath string) (*Metadata, error)

Parser is contract that will be defined by each provider to parse remote metadata from path

type RepositoryAsset

type RepositoryAsset struct {
	Name string `yaml:"name"`
	URL  string `yaml:"url"`
}

RepositoryAsset defines a specific asset for a release

type RepositoryOwner

type RepositoryOwner struct {
	Name     string               `yaml:"name"`
	Provider string               `yaml:"provider"`
	Projects []*RepositoryProject `yaml:"projects"`
}

RepositoryOwner represents the owner of an extension repository

type RepositoryProject

type RepositoryProject struct {
	Name          string               `yaml:"name"`
	CommandName   string               `yaml:"command_name"`
	ActiveTagName string               `yaml:"active_tag_name"`
	LocalDirPath  string               `yaml:"local_dir_path"`
	Releases      []*RepositoryRelease `yaml:"releases"`

	Owner *RepositoryOwner `yaml:"-"`
}

RepositoryProject represents the repository or place where the extension projects resides

type RepositoryRelease

type RepositoryRelease struct {
	TagName        string `yaml:"tag_name"`
	CurrentAPIPath string `yaml:"current_api_path"`
	UpgradeAPIPath string `yaml:"upgrade_api_path"`
	// Metadata is additional metadata which might be
	// required. Each provider can define the key
	// and its value according to its own requirements.
	Metadata map[string]interface{} `yaml:"metadata"`
	Assets   []*RepositoryAsset     `yaml:"assets"`

	Project *RepositoryProject `yaml:"-"`
}

RepositoryRelease defines the release version of a repository release

Jump to

Keyboard shortcuts

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