krakend: github.com/devopsfaith/krakend/plugin Index | Examples | Files

package plugin

import "github.com/devopsfaith/krakend/plugin"

Index

Examples

Package Files

plugin.go register.go

Constants

const REGISTRABLE_VAR = "Registrable"

REGISTRABLE_VAR is the name to lookup after loading the plugin for the module registering

func Load Uses

func Load(cfg config.Plugin, reg *Register) (int, error)

Load loads all the plugins in pluginFolder with pattern in its filename. It returns the number of plugins loaded and an error if something goes wrong.

type Plugin Uses

type Plugin interface {
    Lookup(name string) (plugin.Symbol, error)
}

Plugin is the interface of the loaded plugins

type Register Uses

type Register struct {
    Decoder  *encoding.DecoderRegister
    SD       *sd.Register
    External *register.Namespaced
}

Register contains all the registers required by the framework and the external modules

func NewRegister Uses

func NewRegister() *Register

NewRegister returns a new register to be used by the plugin loader

func (*Register) Register Uses

func (r *Register) Register(p Plugin) error

Register registers the received plugin in the proper internal registers

Code:

reg := NewRegister()
p := dummyPlugin{
    content: plugin.Symbol(registrableDummy(1)),
}
if err := reg.Register(p); err != nil {
    fmt.Println(err.Error())
}

Output:

registrable 1 from plugin samplePluginName is registering its decoder components
registrable 1 from plugin samplePluginName is registering its components depending on external modules

Code:

reg := NewRegister()
p := dummyPlugin{
    content: plugin.Symbol(1),
}
if err := reg.Register(p); err != nil {
    fmt.Println(err.Error())
}

Output:

unknown registrable interface

type RegistrableDecoder Uses

type RegistrableDecoder interface {
    RegisterDecoder(func(name string, dec func(bool) func(io.Reader, *map[string]interface{}) error) error) error
}

RegistrableDecoder defines the interface the encoding plugins should implement in order to be able to register themselves

type RegistrableExternal Uses

type RegistrableExternal interface {
    RegisterExternal(func(namespace, name string, v interface{})) error
}

RegistrableExternal defines the interface the external plugins should implement in order to be able to register themselves

Package plugin imports 9 packages (graph). Updated 2019-02-04. Refresh now. Tools for package owners.