plugin

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const NameField = "plugin_name"

NameField is a required field in Config.

Variables

View Source
var (
	Reg map[reflect.Type]map[string]reflect.Value
)

the global plugin registry

Functions

func RegisterPlugin

func RegisterPlugin(plugin Plugin)

RegisterPlugin registers the pluginType as plugin. If the plugin is a pointer receiver, please pass a pointer. Otherwise, please pass a value.

func RegisterPluginCategory

func RegisterPluginCategory(pluginType reflect.Type)

RegisterPluginCategory register the RegInfo to the global type registry.

Types

type Config

type Config map[string]interface{}

Config is used to initialize the DefaultInitializingPlugin.

type Plugin

type Plugin interface {
	// Name returns the name of the specific plugin.
	Name() string
	// Description returns the description of the specific plugin.
	Description() string
	// Config returns the default config, that is a YAML pattern.
	DefaultConfig() string
}

Plugin defines the plugin model in Satellite.

func Get

func Get(category reflect.Type, cfg Config) Plugin

Get an initialized specific plugin according to the pluginCategory and config.

type SharingPlugin

type SharingPlugin interface {
	Plugin

	// Prepare the sharing plugins, such as build the connection with the external services.
	Prepare() error
	// Start a server to receive the input APM data.
	Start() error
	// Close the sharing plugin.
	Close() error
}

SharingPlugin the plugins cloud be sharing with different modules in different namespaces.

Jump to

Keyboard shortcuts

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