plugin

package
v0.0.0-...-d3ed2aa Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TypeServiceDiscovery serviceDiscovery plugin
	TypeServiceDiscovery = "service-discovery"

	// URLPrefix url prefix
	URLPrefix = "/plugins/"

	// POST post method
	POST = "POST"
	// GET get method
	GET = "GET"
	// PUT put method
	PUT = "PUT"
	// DELETE delete method
	DELETE = "DELETE"
)
View Source
const (
	// CodeSuccess code success
	CodeSuccess = iota
	// CodeError code error
	CodeError
)

Variables

View Source
var (
	// ErrPluginNotFound Plugin not found
	ErrPluginNotFound = errors.New("Plugin not found")
)

Functions

This section is empty.

Types

type Plugin

type Plugin struct {
	Type    string `json:"type"`
	Address string `json:"address"`
}

Plugin plugin define

func (*Plugin) Marshal

func (p *Plugin) Marshal() []byte

Marshal marshal

type RegistryCenter

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

RegistryCenter plugin registry center The plugin registry center will scan plugin dir to find usable plugins. Than plugin registry center do regist spec plugin use a http get access

func NewRegistryCenter

func NewRegistryCenter(cnf *conf.Conf, httpClient *util.FastHTTPClient) *RegistryCenter

NewRegistryCenter get a RegistryCenter

func (*RegistryCenter) DoDelete

func (c *RegistryCenter) DoDelete(pluginType string, action string, data []byte) ([]byte, error)

DoDelete do delete

func (*RegistryCenter) DoGet

func (c *RegistryCenter) DoGet(pluginType string, action string) ([]byte, error)

DoGet do get

func (*RegistryCenter) DoPost

func (c *RegistryCenter) DoPost(pluginType string, action string, data []byte) ([]byte, error)

DoPost do post

func (*RegistryCenter) DoPut

func (c *RegistryCenter) DoPut(pluginType string, action string, data []byte) ([]byte, error)

DoPut do put

func (*RegistryCenter) Load

func (c *RegistryCenter) Load() error

Load load plugin from plugin_dir

type Result

type Result struct {
	Code  int         `json:"code, omitempty"`
	Error string      `json:"error"`
	Value interface{} `json:"value"`
}

Result result

Jump to

Keyboard shortcuts

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