plugin

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Handshake = plugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "MOSN_PLUGIN",
	MagicCookieValue: "ON",
}
View Source
var PluginMap = map[string]plugin.Plugin{
	"MOSN_SERVICE": &Plugin{},
}

Functions

func AdminApi

func AdminApi(w http.ResponseWriter, r *http.Request)

func CheckPluginStatus

func CheckPluginStatus(name string) (string, error)

CheckPluginStatus check plugin's status

func ClosePlugin

func ClosePlugin(name string) error

ClosePlugin disable plugin

func GetLogPath

func GetLogPath() string

func InitPlugin

func InitPlugin(log string)

func OpenPlugin

func OpenPlugin(name string) error

OpenPlugin open plugin

func Serve

func Serve(service Service)

Serve is a function used to serve a plugin. This should be ran on the plugin's main process.

Types

type Client

type Client struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Client is a plugin client, It's primarily used to call request.

func Register

func Register(name string, config *Config) (*Client, error)

Register called by plugin client and start up the plugin main process.

func (*Client) Call

func (c *Client) Call(request *proto.Request, timeout time.Duration) (*proto.Response, error)

Call invokes the function synchronously.

func (*Client) Check

func (c *Client) Check() error

func (*Client) Status

func (c *Client) Status() (enable, on bool)

type Config

type Config struct {
	MaxProcs int
	Args     []string
}

type Plugin

type Plugin struct {
	// GRPCPlugin must still implement the Plugin interface
	plugin.Plugin
	// Concrete implementation, written in Go. This is only used for plugins
	// that are written in Go.
	Impl Service
}

This is the implementation of plugin.GRPCPlugin so we can serve/consume this.

func (*Plugin) GRPCClient

func (p *Plugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (*Plugin) GRPCServer

func (p *Plugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

type Service

type Service interface {
	Call(request *proto.Request) (*proto.Response, error)
}

Service is a service that Implemented by plugin main process

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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