Documentation ¶
Overview ¶
Package rpc contains the API that can be used to serve Sentinel plugins over an RPC interface. Sentinel supports consuming plugins across RPC with the requirement that the RPC must happen over a completely reliable network (effectively a local network).
## Object Plugins
Object plugins allow Sentinel values to be served over a plugin interface. This implements the object.External interface exported by lang/object.
There are limitations to the types of values that can be returned when this is served over a plugin:
All Go primitives and collections that the External interface allows may be returned, including structs.
All primitive and collection Object implementations may be returned.
ExternalObj, External may not yet be returned. We plan to allow this.
Index ¶
- Constants
- Variables
- func Serve(opts *ServeOpts)
- type Plugin
- type PluginFunc
- type PluginGRPCClient
- type PluginGRPCServer
- func (m *PluginGRPCServer) Close(ctx context.Context, v *proto.Close_Request) (*proto.Empty, error)
- func (m *PluginGRPCServer) Configure(ctx context.Context, v *proto.Configure_Request) (*proto.Configure_Response, error)
- func (m *PluginGRPCServer) Get(ctx context.Context, v *proto.Get_MultiRequest) (*proto.Get_MultiResponse, error)
- type ServeOpts
Constants ¶
const (
PluginName = "import"
)
The constants below are the names of the plugins that can be dispensed from the plugin server.
Variables ¶
var Handshake = goplugin.HandshakeConfig{
ProtocolVersion: 3,
MagicCookieKey: "SENTINEL_PLUGIN_MAGIC_COOKIE",
MagicCookieValue: "2b7847b7b705781d7cf21a05e9c1bb37cbf078aea103bc3edcc6aca52ab65453",
}
Handshake is the HandshakeConfig used to configure clients and servers.
var PluginMap = map[string]goplugin.Plugin{ PluginName: &Plugin{}, }
PluginMap should be used by clients for the map of plugins.
Functions ¶
Types ¶
type Plugin ¶ added in v0.4.0
type Plugin struct { goplugin.NetRPCUnsupportedPlugin F func() sdk.Plugin }
Plugin is the goplugin.Plugin implementation to serve sdk.Plugin.
func (*Plugin) GRPCClient ¶ added in v0.4.0
func (p *Plugin) GRPCClient(_ context.Context, _ *goplugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*Plugin) GRPCServer ¶ added in v0.4.0
type PluginFunc ¶ added in v0.4.0
type PluginGRPCClient ¶ added in v0.4.0
type PluginGRPCClient struct { Client proto.PluginClient // contains filtered or unexported fields }
PluginGRPCClient is a gRPC server for Plugins.
func (*PluginGRPCClient) Close ¶ added in v0.4.0
func (m *PluginGRPCClient) Close() error
func (*PluginGRPCClient) Configure ¶ added in v0.4.0
func (m *PluginGRPCClient) Configure(config map[string]interface{}) error
type PluginGRPCServer ¶ added in v0.4.0
PluginGRPCServer is a gRPC server for Plugins.
func (*PluginGRPCServer) Close ¶ added in v0.4.0
func (m *PluginGRPCServer) Close( ctx context.Context, v *proto.Close_Request) (*proto.Empty, error)
func (*PluginGRPCServer) Configure ¶ added in v0.4.0
func (m *PluginGRPCServer) Configure( ctx context.Context, v *proto.Configure_Request) (*proto.Configure_Response, error)
func (*PluginGRPCServer) Get ¶ added in v0.4.0
func (m *PluginGRPCServer) Get( ctx context.Context, v *proto.Get_MultiRequest) (*proto.Get_MultiResponse, error)
type ServeOpts ¶
type ServeOpts struct {
PluginFunc PluginFunc
}
ServeOpts are the configurations to serve a plugin.