Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrAlreadyInitialized = errors.New("registry has already been initialized")
var ErrIDInvalidField = errors.New("invalid id: invalid field")
var ErrIDInvalidFieldName = fmt.Errorf("%w 'Name' (expected: %v)", ErrIDInvalidField, reKeyName)
var ErrIDInvalidFieldType = fmt.Errorf("%w 'Type' (expected: %v)", ErrIDInvalidField, reKeyType)
var ErrIDInvalidFieldVersion = fmt.Errorf("%w 'Version' (expected: %v)", ErrIDInvalidField, reKeyVersion)
var ErrKeyInvalidFormat = errors.New("invalid format: expected <type>/<name>@<version>")
var ErrManifestNotFound = errors.New("manifest not found")
var ErrNoPluginsDirPath = errors.New("registry plugin directory path has not been set")
var ErrNotInitialized = errors.New("registry has not been initialized")
Functions ¶
This section is empty.
Types ¶
type FileSystemRegistry ¶
type FileSystemRegistry struct { PluginsDirPath string // contains filtered or unexported fields }
FileSystemRegistry implements plugin.Registry using a local directory of plugins.
func NewFileSystemRegistry ¶
func NewFileSystemRegistry(srcDirPath string) (*FileSystemRegistry, error)
func (*FileSystemRegistry) Initialize ¶
func (r *FileSystemRegistry) Initialize() error
func (*FileSystemRegistry) IsInitialized ¶
func (r *FileSystemRegistry) IsInitialized() bool
func (*FileSystemRegistry) LoadPlugin ¶
func (r *FileSystemRegistry) LoadPlugin(manifest Manifest) (Plugin, error)
LoadPlugin loads a plugin from the registry into the local environment and memory via the passed plugin ID.
func (*FileSystemRegistry) ValidatePlugin ¶
func (r *FileSystemRegistry) ValidatePlugin(pluginID ID) (Manifest, error)
ValidatePlugin validates that the prerequisites of a plugin in the registry are given for the plugin's manifest. Prerequisites may be defined as dependencies, versions, and licensing.
Not to be confused with validating the prerequisites of a plugin in the project during plugin installation.
type ID ¶
type ID struct { Name string `json:"name"` Version string `json:"version"` Type Type `json:"type"` }
func (*ID) FromKey ¶
FromKey parses a string plugin identifier key in the format `<type>/<name>@<version>`.
Example key: compile/go-struct@5.3.2
func (ID) String ¶
String implements the Stringer interface and outputs the plugin identifier as a plugin identifier key in the format `<type>/<name>@<version>` without validation.
type InstallValidateable ¶
type InstallValidateable interface { OnInstallValidateStart(attempt Installation) error OnInstallValidateSuccess(attempt Installation) error OnInstallValidateFailure(attempt Installation, failure error) }
type InstallVerifiable ¶
type InstallVerifiable interface { OnInstallVerifyStart(attempt Installation) error OnInstallVerifySuccess(attempt Installation) error OnInstallVerifyFailure(attempt Installation, failure error) }
type Installation ¶
func NewInstallation ¶
func NewInstallation(plugin Plugin) Installation
type Manifest ¶
type Manifest struct { ID ID `json:"id"` Author string `json:"author"` Description string `json:"description"` }
func (*Manifest) UnmarshalJSON ¶
type Registry ¶
type Registry interface { // Initialize initializes the plugin once when it is loaded. Initialize() error // IsInitialized returns whether or not the plugin has been initialized after loading. IsInitialized() bool // ValidatePlugin validates that the prerequisites of a plugin in the registry are given for the plugin's manifest. // // Prerequisites may be defined as dependencies, versions, and licensing. ValidatePlugin(id ID) (Manifest, error) // LoadPlugin loads a plugin from the registry into the local environment and memory via the passed plugin ID. LoadPlugin(manifest Manifest) (Plugin, error) }