pkg

package
v2.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2020 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LoadedEvent event name
	// Triggered after loading a plugin or set of plugins
	LoadedEvent string = "loaded_event"
	// PluginRegisteredEvent event name
	// Triggered after registering a plugin
	PluginRegisteredEvent string = "plugin_registered_event"
	// ServiceStartedEvent event name
	// Triggered after starting a service
	ServiceStartedEvent string = "service_started_event"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	LoadPluginsDir(directory string) error
	LoadPlugins(v ...Plugin) error
	Emit(name string, v interface{})
	Walk(func(manifest Manifest, v Plugin))
	GetPlugins() []Plugin
}

Handler defines a set of functions that can be used by plugins and the application see pkg/handler for implementation of interface

type Manifest

type Manifest struct {
	Namespace   string
	Description string
	Events      map[string]func(event string, v interface{})
	Config      interface{}
	Data        map[string]interface{}
}

Manifest defines the requirements of a plugin to the handler

type Plugin

type Plugin interface {
	Manifest() Manifest
	Register(h Handler) error
}

Plugin defines a basic plugin

type Service

type Service interface {
	Plugin
	Start()
}

Service defines a service plugin service plugins are started as a go routine when the plugin is registered

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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