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 ¶
func (c *GRPCClient) Apply(req *proto.ApplyRequest) (*proto.ApplyResponse, error)
Apply applies the rule to the proto.
func (*GRPCClient) ListRules ¶
func (c *GRPCClient) ListRules(req *proto.ListRulesRequest) (*proto.ListRulesResponse, error)
ListRules returns all supported rules metadata.
type GRPCServer ¶
type GRPCServer struct {
// contains filtered or unexported fields
}
GRPCServer is the implementation of RuleSet.
func (*GRPCServer) Apply ¶
func (s *GRPCServer) Apply(_ context.Context, req *proto.ApplyRequest) (*proto.ApplyResponse, error)
Apply applies the rule to the proto.
func (*GRPCServer) ListRules ¶
func (s *GRPCServer) ListRules(_ context.Context, req *proto.ListRulesRequest) (*proto.ListRulesResponse, error)
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.
Click to show internal directories.
Click to hide internal directories.