skplug

package
v0.0.0-...-b71e5f6 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2019 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Handshake = plugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "SKENARIO_PLUGIN",
	MagicCookieValue: "skplug",
}

Handshake is a common handshake that is shared by plugin and host.

View Source
var PluginMap = map[string]plugin.Plugin{
	"autoscaler": &AutoscalerPlugin{},
}

PluginMap is the map of plugins we can dispense.

Functions

This section is empty.

Types

type Autoscaler

type Autoscaler proto.Autoscaler

type AutoscalerPlugin

type AutoscalerPlugin struct {
	plugin.NetRPCUnsupportedPlugin
	// Concrete implementation, written in Go. This is only used for plugins
	// that are written in Go.
	Impl Plugin
}

This is the implementation of plugin.Plugin so we can serve/consume this. We also implement GRPCPlugin so that this plugin can be served over gRPC.

func (*AutoscalerPlugin) GRPCClient

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

func (*AutoscalerPlugin) GRPCServer

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

type GRPCClient

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

GRPCClient is an implementation of Plugin that talks over RPC.

func (*GRPCClient) Event

func (m *GRPCClient) Event(partition string, time int64, typ proto.EventType, object Object) error

func (*GRPCClient) Scale

func (m *GRPCClient) Scale(partition string, time int64) (rec int32, err error)

func (*GRPCClient) Stat

func (m *GRPCClient) Stat(partition string, stats []*proto.Stat) error

type GRPCServer

type GRPCServer struct {
	// This is the real implementation
	Impl Plugin
	// contains filtered or unexported fields
}

GRPCServer is the gRPC server that the GRPCClient talks to.

func (*GRPCServer) Event

func (m *GRPCServer) Event(ctx context.Context, req *proto.EventRequest) (*proto.Empty, error)

func (*GRPCServer) Scale

func (*GRPCServer) Stat

func (m *GRPCServer) Stat(ctx context.Context, req *proto.StatRequest) (*proto.Empty, error)

type Object

type Object interface {
	// contains filtered or unexported methods
}

type Plugin

type Plugin interface {
	Event(partition string, time int64, typ proto.EventType, object Object) error
	Stat(partition string, stat []*proto.Stat) error
	Scale(partition string, time int64) (rec int32, err error)
}

Plugin is the interface that we're exposing as a plugin.

type Pod

type Pod proto.Pod

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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