shared

package
v0.49.7 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

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 plugin and host.

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

PluginMap is the map of plugins we can dispense.

Functions

This section is empty.

Types

type GRPCClient

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

GRPCClient is the implementation of RuleSet.

func (*GRPCClient) Apply

Apply applies the rule to the proto.

func (*GRPCClient) ListRules

ListRules returns all supported rules metadata.

type GRPCServer

type GRPCServer struct {
	proto.UnimplementedRuleSetServiceServer
	// contains filtered or unexported fields
}

GRPCServer is the implementation of RuleSet.

func (*GRPCServer) Apply

Apply applies the rule to the proto.

func (*GRPCServer) ListRules

ListRules returns all supported rules metadata.

type RuleSet

type RuleSet interface {
	ListRules(*proto.ListRulesRequest) (*proto.ListRulesResponse, error)
	Apply(*proto.ApplyRequest) (*proto.ApplyResponse, error)
}

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

type RuleSetGRPCPlugin

type RuleSetGRPCPlugin struct {
	plugin.Plugin
	Impl RuleSet
}

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

func (*RuleSetGRPCPlugin) GRPCClient

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

GRPCClient returns the interface implementation for the plugin.

func (*RuleSetGRPCPlugin) GRPCServer

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

GRPCServer registers this plugin.

Jump to

Keyboard shortcuts

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