Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrPluginNotFound = errors.New("vinxi: plugin does not exists")
ErrPluginNotFound is used when a plugin does not exists.
var Plugins = make(map[string]Info)
Plugins is used to store the available plugins globally.
Functions ¶
Types ¶
type Factory ¶
Factory represents the plugin factory function interface.
func GetFactory ¶
GetFactory is used to find and retrieve a plugin factory function.
type Field ¶
type Field struct { Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` Description string `json:"description,omitempty"` Mandatory bool `json:"mandatory,omitempty"` Examples []string `json:"examples,omitempty"` Default interface{} `json:"default,omitempty"` Validator Validator `json:"-"` }
Field is used to declare specific config fields supported by plugins.
type Info ¶
type Info struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Params Params `json:"params,omitempty"` Factory Factory `json:"-"` }
Info represents the plugin entity fields storing the name, description and factory function used to initialize the fields.
type Layer ¶
type Layer struct {
// contains filtered or unexported fields
}
Layer represents a plugins layer designed to intrument proxies providing plugin based dynamic configuration capabilities, such as register/unregister or enable/disable plugins at runtime satefy.
func (*Layer) HandleHTTP ¶
HandleHTTP triggers the plugins layer call chain. This function is designed to be executed by top-level middleware layers.
type Plugin ¶
type Plugin interface { // ID is used to retrieve the plugin unique identifier. ID() string // Name is used to retrieve the plugin name identifier. Name() string // Description is used to retrieve a human friendly // description of what the plugin does. Description() string // Config is used to retrieve the user defined plugin config. Config() config.Config // Metadata is used to retrieve the plugin metadata. Metadata() config.Config // HandleHTTP is used to run the plugin task. // Note: add error reporting layer. HandleHTTP(http.Handler) http.Handler }
Plugin represents the required interface implemented by plugins.