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 ImportFunc
- type ImportGRPCClient
- type ImportGRPCServer
- func (m *ImportGRPCServer) Close(ctx context.Context, v *proto.Close_Request) (*proto.Empty, error)
- func (m *ImportGRPCServer) Configure(ctx context.Context, v *proto.Configure_Request) (*proto.Configure_Response, error)
- func (m *ImportGRPCServer) Get(ctx context.Context, v *proto.Get_MultiRequest) (*proto.Get_MultiResponse, error)
- type ImportPlugin
- type ServeOpts
Constants ¶
const (
ImportPluginName = "import"
)
The constants below are the names of the plugins that can be dispensed from the plugin server.
Variables ¶
var Handshake = goplugin.HandshakeConfig{
ProtocolVersion: 2,
MagicCookieKey: "SENTINEL_PLUGIN_MAGIC_COOKIE",
MagicCookieValue: "2b7847b7b705781d7cf21a05e9c1bb37cbf078aea103bc3edcc6aca52ab65453",
}
Handshake is the HandshakeConfig used to configure clients and servers.
var PluginMap = map[string]goplugin.Plugin{ ImportPluginName: &ImportPlugin{}, }
PluginMap should be used by clients for the map of plugins.
Functions ¶
Types ¶
type ImportFunc ¶
type ImportFunc func() sdk.Import
type ImportGRPCClient ¶
type ImportGRPCClient struct { Client proto.ImportClient // contains filtered or unexported fields }
ImportGRPCClient is a gRPC server for Imports.
func (*ImportGRPCClient) Close ¶
func (m *ImportGRPCClient) Close() error
func (*ImportGRPCClient) Configure ¶
func (m *ImportGRPCClient) Configure(config map[string]interface{}) error
func (*ImportGRPCClient) Get ¶
func (m *ImportGRPCClient) Get(rawReqs []*sdk.GetReq) ([]*sdk.GetResult, error)
type ImportGRPCServer ¶
type ImportGRPCServer struct { F func() sdk.Import // contains filtered or unexported fields }
ImportGRPCServer is a gRPC server for Imports.
func (*ImportGRPCServer) Close ¶
func (m *ImportGRPCServer) Close( ctx context.Context, v *proto.Close_Request) (*proto.Empty, error)
type ImportPlugin ¶
type ImportPlugin struct { goplugin.NetRPCUnsupportedPlugin F func() sdk.Import }
ImportPlugin is the goplugin.Plugin implementation to serve sdk.Import.
func (*ImportPlugin) GRPCClient ¶
func (p *ImportPlugin) GRPCClient(_ context.Context, _ *goplugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*ImportPlugin) GRPCServer ¶
func (p *ImportPlugin) GRPCServer(_ *goplugin.GRPCBroker, s *grpc.Server) error
type ServeOpts ¶
type ServeOpts struct {
ImportFunc ImportFunc
}
ServeOpts are the configurations to serve a plugin.