plugin

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2025 License: Apache-2.0 Imports: 12 Imported by: 16

Documentation

Index

Constants

View Source
const (
	ProtocolVersion  = 1
	MagicCookieKey   = "DODO_PLUGIN"
	MagicCookieValue = "69318785-d741-4150-ac91-8f03fa703530"
)
View Source
const (
	FailedPlugin = "error"
)

Variables

This section is empty.

Functions

func PathByName

func PathByName(name string) string

Types

type CircularDependencyError

type CircularDependencyError struct {
	Dependencies map[dependency]mapset.Set
}

func (CircularDependencyError) Error

func (e CircularDependencyError) Error() string

type Config added in v0.8.0

type Config map[string]string

type Dependencies added in v0.10.0

type Dependencies []ID

func DependenciesFromProto added in v0.10.0

func DependenciesFromProto(deps []*api.PluginID) Dependencies

func (Dependencies) ToProto added in v0.10.0

func (d Dependencies) ToProto() []*api.PluginID

type ID added in v0.10.0

type ID struct {
	Type string
	Name string
}

func IDFromProto added in v0.10.0

func IDFromProto(id *api.PluginID) ID

func (ID) ToProto added in v0.10.0

func (id ID) ToProto() *api.PluginID

type InvalidError

type InvalidError struct {
	PluginID ID
	Message  string
}

func NewInvalidError added in v0.10.0

func NewInvalidError(t Type, name, msg string) InvalidError

func (InvalidError) Error

func (e InvalidError) Error() string

type Labels added in v0.10.0

type Labels map[string]string

type Manager

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

func Init

func Init() Manager

func (Manager) GetPlugins

func (m Manager) GetPlugins(pluginType string) map[string]Plugin

func (Manager) IncludePlugins

func (m Manager) IncludePlugins(plugins ...Plugin)

func (Manager) LoadPlugins

func (m Manager) LoadPlugins()

func (Manager) RegisterPluginTypes

func (m Manager) RegisterPluginTypes(ts ...Type)

func (Manager) ServePlugins

func (m Manager) ServePlugins(plugins ...Plugin) error

func (Manager) UnloadPlugins

func (m Manager) UnloadPlugins()

type Metadata added in v0.10.0

type Metadata struct {
	ID           ID
	Dependencies Dependencies
	Labels       Labels
}

func MetadataFromProto added in v0.10.0

func MetadataFromProto(m *api.PluginMetadata) Metadata

func NewFailedPluginInfo added in v0.10.0

func NewFailedPluginInfo(t Type, err error) Metadata

func NewMetadata added in v0.10.0

func NewMetadata(pluginType Type, name string) Metadata

func (Metadata) ToProto added in v0.10.0

func (m Metadata) ToProto() *api.PluginMetadata

func (Metadata) WithDependencies added in v0.10.0

func (m Metadata) WithDependencies(deps ...Plugin) Metadata

func (Metadata) WithLabels added in v0.10.0

func (m Metadata) WithLabels(labels Labels) Metadata

type NotFoundError

type NotFoundError struct {
	PluginID ID
}

func NewNotFoundError added in v0.10.0

func NewNotFoundError(t Type, name string) NotFoundError

func (NotFoundError) Error

func (e NotFoundError) Error() string

type Plugin

type Plugin interface {
	Type() Type
	Metadata() Metadata
	Init() (Config, error)
	Cleanup()
}

func ResolveDependencies

func ResolveDependencies(pluginMap map[string]map[string]Plugin) []Plugin

type StreamConfig

type StreamConfig struct {
	Stdin          io.Reader
	Stdout         io.Writer
	Stderr         io.Writer
	TerminalHeight uint32
	TerminalWidth  uint32
}

type Type

type Type interface {
	String() string
	GRPCClient() (plugin.Plugin, error)
	GRPCServer(p Plugin) (plugin.Plugin, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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