plugin

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const ApptainerSource = "apptainer_source"

ApptainerSource represents the symlink name which will point to the Apptainer source directory.

Variables

This section is empty.

Functions

func Create

func Create(path, name string) error

Create creates a skeleton plugin directory structure to start development of a new plugin.

func Disable

func Disable(name string) error

Disable disables the plugin named "name" found under rootDir.

func Enable

func Enable(name string) error

Enable enables the plugin named "name" found under rootDir.

func Inspect

func Inspect(name string) (pluginapi.Manifest, error)

Inspect obtains information about the plugin "name".

"name" can be either the name of plugin installed under rootDir or the name of an image file corresponding to a plugin.

func Install

func Install(sifPath string) error

Install installs a plugin from a SIF image under rootDir. It will:

  1. Check that the SIF is a valid plugin
  2. Use name from Manifest and calculate the installation path
  3. Copy the SIF into the plugin path
  4. Extract the binary object into the path
  5. Generate a default config file in the path
  6. Write the Meta struct onto disk in dirRoot

func LoadCallbacks

func LoadCallbacks(cb pluginapi.Callback) ([]pluginapi.Callback, error)

LoadCallbacks loads plugins registered for the hook instance passed in parameter.

func LoadObject

func LoadObject(path string) (*pluginapi.Plugin, error)

LoadObject loads a plugin object in memory and returns the Plugin object set within the plugin.

func PrepareGoModules

func PrepareGoModules(pluginDir string, disableMinorCheck bool) ([]byte, error)

PrepareGoModules returns a byte array containing a generated go.mod matching Apptainer modules in use in order to compile/load the plugin with same version of dependencies.

func Uninstall

func Uninstall(name string) error

Uninstall removes the plugin matching "name" from the apptainer plugin installation directory.

Types

type GoMod

type GoMod struct {
	Module  Module
	Go      string
	Require []Require
	Exclude []Module
	Replace []Replace
}

GoMod describes a parsed go.mod file.

func GetModules

func GetModules(dir string) (*GoMod, error)

GetModules parses the go.mod file found in directory and returns a GoMod instance.

func (GoMod) GetExclude

func (g GoMod) GetExclude(path string) *Module

GetExclude returns the exclude record for the provided module path.

func (GoMod) GetReplace

func (g GoMod) GetReplace(path string) *Replace

GetReplace returns the replace record for the provided module path.

func (GoMod) GetRequire

func (g GoMod) GetRequire(path string) *Require

GetRequire returns the require record for the provided module path.

type Meta

type Meta struct {
	// Name is the name of the plugin.
	Name string
	// Enabled reports whether or not the plugin should be loaded.
	Enabled bool
	// Callbacks contains callbacks name registered by the plugin.
	Callbacks []string
}

Meta is an internal representation of a plugin binary and all of its artifacts. This represents the on-disk location of the SIF, shared library, config file, etc... This struct is written as JSON into the rootDir directory.

func List

func List() ([]*Meta, error)

List returns all the apptainer plugins installed in rootDir in the form of a list of Meta information.

type Module

type Module struct {
	Path    string
	Version string
}

Module describes a Go module with its corresponding path and version.

func (Module) String

func (m Module) String() string

String returns the string representation of a module.

type Replace

type Replace struct {
	Old Module
	New Module
}

Replace describes a replace directive in go.mod files.

func (Replace) String

func (r Replace) String() string

String returns the string representation of a replace line.

type Require

type Require struct {
	Path     string
	Version  string
	Indirect bool
}

Require describes a require directive in go.mod files.

func (Require) String

func (r Require) String() string

String returns the string representation of a require line.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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