Documentation ¶
Index ¶
- Variables
- func Download(pluginURL string, pluginPath string) error
- func SendCDEvent(event string, messageBrokerURL string) error
- func ValidateURL(URL string) (string, error)
- type EventTranslator
- type GRPCClient
- type GRPCServer
- type Plugin
- type RPCClient
- type RPCServer
- type Translator
- type TranslatorGRPCPlugin
- type TranslatorPlugin
- type TranslatorPlugins
Constants ¶
This section is empty.
Variables ¶
View Source
var Handshake = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "BASIC_PLUGIN",
MagicCookieValue: "hello",
}
Handshake is a common handshake that is shared by plugins and host.
View Source
var PluginMap = map[string]plugin.Plugin{ "translator_grpc": &TranslatorGRPCPlugin{}, "translator": &TranslatorPlugin{}, }
PluginMap is the map of plugins we can dispense.
Functions ¶
func SendCDEvent ¶
func ValidateURL ¶
Types ¶
type EventTranslator ¶
type EventTranslator interface {
TranslateEvent(event string, headers http.Header) (string, error)
}
EventTranslator is the interface that we're exposing as a plugins.
type GRPCClient ¶
type GRPCClient struct {
// contains filtered or unexported fields
}
func (*GRPCClient) TranslateEvent ¶
type GRPCServer ¶
type GRPCServer struct {
Impl EventTranslator
}
func (*GRPCServer) TranslateEvent ¶
func (m *GRPCServer) TranslateEvent(ctx context.Context, req *proto.TranslateEventRequest) (*proto.TranslateEventResponse, error)
type RPCClient ¶
type RPCClient struct {
// contains filtered or unexported fields
}
RPCClient is an implementation of EventTranslator that talks over RPC.
type RPCServer ¶
type RPCServer struct { // This is the real implementation Impl EventTranslator }
Here is the RPC server that RPCClient talks to, conforming to the requirements of net/rpc
type Translator ¶
type TranslatorGRPCPlugin ¶
type TranslatorGRPCPlugin 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 EventTranslator }
TranslatorGRPCPlugin is the implementation of plugin.GRPCPlugin so we can serve/consume this.
func (*TranslatorGRPCPlugin) GRPCClient ¶
func (p *TranslatorGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*TranslatorGRPCPlugin) GRPCServer ¶
func (p *TranslatorGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
type TranslatorPlugin ¶
type TranslatorPlugin struct { // Concrete implementation, written in Go. This is only used for plugins // that are written in Go. Impl EventTranslator }
TranslatorPlugin is the implementation of plugins.Plugin so we can serve/consume this.
func (*TranslatorPlugin) Client ¶
func (*TranslatorPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)
func (*TranslatorPlugin) Server ¶
func (p *TranslatorPlugin) Server(*plugin.MuxBroker) (interface{}, error)
type TranslatorPlugins ¶
type TranslatorPlugins struct {
Translator Translator `yaml:"translator"`
}
func LoadConfig ¶
func LoadConfig(fileName string) (*TranslatorPlugins, error)
Click to show internal directories.
Click to hide internal directories.