plugins

package module
v0.0.0-...-2d63530 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HandshakeConfig = plugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "BASIC_PLUGIN",
	MagicCookieValue: "hello",
}

handshakeConfigs are used to just do a basic handshake between a plugin and host. If the handshake fails, a user friendly error is shown. This prevents users from executing bad plugins or executing a plugin directory. It is a UX feature, not a security feature.

Functions

This section is empty.

Types

type CheckMessageSidelineImpl

type CheckMessageSidelineImpl interface {
	CheckMessageSideline(key []byte) ([]byte, error)
	SidelineMessage(msg []byte) SidelineMessageResponse
	InitialisePlugin(conf []byte) error
}

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

type CheckMessageSidelineImplPlugin

type CheckMessageSidelineImplPlugin struct{}

Dummy implementation of a plugin.Plugin interface for use in PluginMap. At runtime, a real implementation from a plugin implementation overwrides this.

func (CheckMessageSidelineImplPlugin) Client

func (CheckMessageSidelineImplPlugin) Client(b *gplugin.MuxBroker, c *rpc.Client) (interface{}, error)

func (CheckMessageSidelineImplPlugin) Server

func (CheckMessageSidelineImplPlugin) Server(*gplugin.MuxBroker) (interface{}, error)

type CheckMessageSidelineRPC

type CheckMessageSidelineRPC struct {
	Client *rpc.Client
}

Here is an implementation that talks over RPC

func (*CheckMessageSidelineRPC) CheckMessageSideline

func (g *CheckMessageSidelineRPC) CheckMessageSideline(key []byte) ([]byte, error)

func (*CheckMessageSidelineRPC) InitialisePlugin

func (g *CheckMessageSidelineRPC) InitialisePlugin(conf []byte) error

func (*CheckMessageSidelineRPC) SidelineMessage

func (g *CheckMessageSidelineRPC) SidelineMessage(msg []byte) SidelineMessageResponse

type CheckMessageSidelineRPCServer

type CheckMessageSidelineRPCServer struct {
	// This is the real implementation
	Impl CheckMessageSidelineImpl
}

Here is the RPC server that CheckMessageSidelineRPC talks to, conforming to the requirements of net/rpc

func (*CheckMessageSidelineRPCServer) CheckMessageSideline

func (s *CheckMessageSidelineRPCServer) CheckMessageSideline(key []byte, resp *[]byte) error

func (*CheckMessageSidelineRPCServer) InitialisePlugin

func (s *CheckMessageSidelineRPCServer) InitialisePlugin(conf []byte, err *error) error

func (*CheckMessageSidelineRPCServer) SidelineMessage

func (s *CheckMessageSidelineRPCServer) SidelineMessage(msg []byte, sidelineMessageResponse *SidelineMessageResponse) error

type CheckMessageSidelineResponse

type CheckMessageSidelineResponse struct {
	SidelineMessage bool
	Version         int32
}

type KafkaHttpSidelineMeta

type KafkaHttpSidelineMeta struct {
	Endpoint string
	Headers  map[string]string
}

type Manager

type Manager struct {
	Type    string                 // id for types of plugins this manager deals with
	Glob    string                 // glob match for plugin filenames
	Path    string                 // path for plugins
	Plugins map[string]*PluginInfo // Info for foudn plugins
	// contains filtered or unexported fields
}

Manager handles lifecycle of plugin mgmt for different plugin types. In This example we have two plugin types: greeter and clubber, both of which have multiple implementations.

func NewManager

func NewManager(ptype, glob, dir string, pluginImpl plugin.Plugin) *Manager

func (*Manager) Dispose

func (m *Manager) Dispose()

func (*Manager) GetInterface

func (m *Manager) GetInterface(id string) (interface{}, error)

func (*Manager) Init

func (m *Manager) Init() error

func (*Manager) Launch

func (m *Manager) Launch() error

type PluginInfo

type PluginInfo struct {
	ID     string
	Path   string
	Client *plugin.Client
}

type ScanImpl

type ScanImpl interface {
	ScanWithStartRowEndRow(request ScanWithStartRowEndRowRequest) ([]string, error)
	ScanWithStartTimeEndTime(request ScanWithStartTimeEndTimeRequest) ([]string, error)
}

type ScanImplPlugin

type ScanImplPlugin struct{}

func (ScanImplPlugin) Client

func (ScanImplPlugin) Client(b *gplugin.MuxBroker, c *rpc.Client) (interface{}, error)

func (ScanImplPlugin) Server

func (ScanImplPlugin) Server(*gplugin.MuxBroker) (interface{}, error)

type ScanImplRPC

type ScanImplRPC struct {
	Client *rpc.Client
}

func (*ScanImplRPC) ScanWithStartRowEndRow

func (g *ScanImplRPC) ScanWithStartRowEndRow(request ScanWithStartRowEndRowRequest) ([]string, error)

func (*ScanImplRPC) ScanWithStartTimeEndTime

func (g *ScanImplRPC) ScanWithStartTimeEndTime(request ScanWithStartTimeEndTimeRequest) ([]string, error)

type ScanImplRPCServer

type ScanImplRPCServer struct {
	Impl ScanImpl
}

func (*ScanImplRPCServer) ScanWithStartRowEndRow

func (s *ScanImplRPCServer) ScanWithStartRowEndRow(request ScanWithStartRowEndRowRequest, resp *[]string) error

func (*ScanImplRPCServer) ScanWithStartTimeEndTime

func (s *ScanImplRPCServer) ScanWithStartTimeEndTime(request ScanWithStartTimeEndTimeRequest, resp *[]string) error

type ScanWithStartRowEndRowRequest

type ScanWithStartRowEndRowRequest struct {
	StartKey string
	EndKey   string
}

type ScanWithStartTimeEndTimeRequest

type ScanWithStartTimeEndTimeRequest struct {
	StartTime int64
	EndTime   int64
	StartKey  string
	EndKey    string
}

type SidelineMessage

type SidelineMessage struct {
	GroupId           string
	Partition         int32
	EntityId          string
	Offset            int64
	ConsumerGroupName string
	ClusterName       string
	Message           []byte
	Version           int32
	ConnectionType    string
	SidelineMeta      []byte
}

type SidelineMessageResponse

type SidelineMessageResponse struct {
	Success                     bool
	ConcurrentModificationError bool
	UnknownError                bool
	ErrorMessage                string
}

type UnsidelineByKeyRequest

type UnsidelineByKeyRequest struct {
	Key      string
	DmuxItem string
}

type UnsidelineImpl

type UnsidelineImpl interface {
	UnsidelineByKey(request UnsidelineByKeyRequest) (string, error)
}

type UnsidelineImplPlugin

type UnsidelineImplPlugin struct{}

func (UnsidelineImplPlugin) Client

func (UnsidelineImplPlugin) Client(b *gplugin.MuxBroker, c *rpc.Client) (interface{}, error)

func (UnsidelineImplPlugin) Server

func (UnsidelineImplPlugin) Server(*gplugin.MuxBroker) (interface{}, error)

type UnsidelineImplRPC

type UnsidelineImplRPC struct {
	Client *rpc.Client
}

func (*UnsidelineImplRPC) UnsidelineByKey

func (g *UnsidelineImplRPC) UnsidelineByKey(request UnsidelineByKeyRequest) (string, error)

type UnsidelineImplRPCServer

type UnsidelineImplRPCServer struct {
	Impl UnsidelineImpl
}

func (*UnsidelineImplRPCServer) UnsidelineByKey

func (s *UnsidelineImplRPCServer) UnsidelineByKey(request UnsidelineByKeyRequest, resp *string) error

Jump to

Keyboard shortcuts

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