plugin

package
v0.0.0-...-5e8511f Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoName = errors.New("No name specified")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Debug   bool                   `yaml:"debug"`
	Path    []string               `yaml:"path"`
	WorkDir string                 `yaml:"workdir"`
	Runner  string                 `yaml:"runtime"`
	Options map[string]interface{} `yaml:"options"`
}

func (*Config) CreateManager

func (c *Config) CreateManager(prom *prom.Manager) (*Manager, error)

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func (*Manager) Close

func (m *Manager) Close() error

func (*Manager) Plugins

func (m *Manager) Plugins() []string

func (*Manager) Start

func (m *Manager) Start(name, typ string) (PluginInterface, error)

func (*Manager) Stdout

func (m *Manager) Stdout(name string) (*StdoutChannel, error)

type Manifest

type Manifest struct {
	Name        string      `yaml:"name"`
	Type        string      `yaml:"type"`
	Permissions Permissions `yaml:"permissions"`
	Prometheus  bool        `yaml:"prometheus"`
}

func ParseManifestFromFile

func ParseManifestFromFile(path string) (*Manifest, error)

path should be the path to the plugin, not directly to the manifest

func (*Manifest) Warnings

func (m *Manifest) Warnings() <-chan Warning

type Permissions

type Permissions struct {
	Container struct {
		Network bool `yaml:"network"`
	} `yaml:"container"`
	App struct {
		Javascript bool `yaml:"javascript"`
		Forms      bool `yaml:"forms"`
		Storage    struct {
			Enabled    bool `yaml:"enabled"`
			ReadWrite  bool `yaml:"readwrite"`
			WholeStore bool `yaml:"wholestore"`
		} `yaml:"storage"`
		FileOpener map[string]string `yaml:"file_opener"`
	} `yaml:"app"`
}

type PluginInterface

type PluginInterface interface {
	GrpcConn() (*grpc.ClientConn, error)
	HttpClient() *http.Client
	StdoutDump() []byte
	Stdout() io.ReadCloser
	Close() error
	Manifest() *Manifest
	WorkDir() string
}

type RunOptions

type RunOptions struct {
	Name     string
	Config   *Config
	Manifest *Manifest
	Stdout   *Stdout
}

type Runner

type Runner interface {
	Start() error
	Close() error
}

type RunnerFactory

type RunnerFactory interface {
	Create(opts *RunOptions) (Runner, error)
	// contains filtered or unexported methods
}

func GetRunnerFactory

func GetRunnerFactory(name string) (RunnerFactory, error)

type Stdout

type Stdout struct {
	// contains filtered or unexported fields
}

func (*Stdout) Bytes

func (s *Stdout) Bytes() []byte

func (*Stdout) Channel

func (s *Stdout) Channel() *StdoutChannel

func (*Stdout) Reader

func (s *Stdout) Reader() io.ReadCloser

func (*Stdout) Write

func (s *Stdout) Write(d []byte) (int, error)

type StdoutChannel

type StdoutChannel struct {
	// contains filtered or unexported fields
}

func (*StdoutChannel) Channel

func (c *StdoutChannel) Channel() <-chan []byte

func (*StdoutChannel) Close

func (c *StdoutChannel) Close() error

type Warning

type Warning struct {
	Fatal bool
	// contains filtered or unexported fields
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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