Documentation
¶
Overview ¶
Package shared contains shared data between the host and plugins.
Index ¶
- Variables
- type Device
- type DevicePlugin
- type GRPCClient
- func (m *GRPCClient) CreateDevice() (uint64, error)
- func (m *GRPCClient) DevicePrint(ptr uint64) error
- func (m *GRPCClient) DeviceSetValue(ptr uint64, value int32) error
- func (m *GRPCClient) DeviceValue(ptr uint64) (int32, error)
- func (m *GRPCClient) FreeDevice(ptr uint64) error
- func (m *GRPCClient) GetDevice(ptr uint64, useJson bool) ([]byte, error)
- type GRPCServer
- func (m *GRPCServer) CreateDevice(ctx context.Context, req *proto.CreateDeviceRequest) (*proto.CreateDeviceResponse, error)
- func (m *GRPCServer) DevicePrint(ctx context.Context, req *proto.DevicePrintRequest) (*proto.DevicePrintResponse, error)
- func (m *GRPCServer) DeviceSetValue(ctx context.Context, req *proto.DeviceSetValueRequest) (*proto.DeviceSetValueResponse, error)
- func (m *GRPCServer) DeviceValue(ctx context.Context, req *proto.DeviceValueRequest) (*proto.DeviceValueResponse, error)
- func (m *GRPCServer) FreeDevice(ctx context.Context, req *proto.FreeDeviceRequest) (*proto.FreeDeviceResponse, error)
- func (m *GRPCServer) GetDevice(ctx context.Context, req *proto.GetDeviceRequest) (*proto.GetDeviceResponse, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var Handshake = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "DEVICE_PLUGIN",
MagicCookieValue: "device",
}
Handshake is a common handshake that is shared by plugin and host.
View Source
var PluginMap = map[string]plugin.Plugin{ "device": &DevicePlugin{}, }
PluginMap is the map of plugins we can dispense.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device interface {
CreateDevice() (uint64, error)
FreeDevice(ptr uint64) error
GetDevice(ptr uint64, useJson bool) ([]byte, error)
DevicePrint(ptr uint64) error
DeviceValue(ptr uint64) (int32, error)
DeviceSetValue(ptr uint64, value int32) error
}
Device is the interface that we're exposing as a plugin.
type DevicePlugin ¶
type DevicePlugin struct {
plugin.NetRPCUnsupportedPlugin
// Concrete implementation, written in Go. This is only used for plugins
// that are written in Go.
Impl Device
}
This is the implementation of plugin.Plugin so we can serve/consume this. We also implement GRPCPlugin so that this plugin can be served over gRPC.
func (*DevicePlugin) GRPCClient ¶
func (p *DevicePlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*DevicePlugin) GRPCServer ¶
func (p *DevicePlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
type GRPCClient ¶
type GRPCClient struct {
// contains filtered or unexported fields
}
func (*GRPCClient) CreateDevice ¶
func (m *GRPCClient) CreateDevice() (uint64, error)
func (*GRPCClient) DevicePrint ¶
func (m *GRPCClient) DevicePrint(ptr uint64) error
func (*GRPCClient) DeviceSetValue ¶
func (m *GRPCClient) DeviceSetValue(ptr uint64, value int32) error
func (*GRPCClient) DeviceValue ¶
func (m *GRPCClient) DeviceValue(ptr uint64) (int32, error)
func (*GRPCClient) FreeDevice ¶
func (m *GRPCClient) FreeDevice(ptr uint64) error
type GRPCServer ¶
type GRPCServer struct {
Impl Device
proto.UnimplementedDeviceServer
// contains filtered or unexported fields
}
func (*GRPCServer) CreateDevice ¶
func (m *GRPCServer) CreateDevice(ctx context.Context, req *proto.CreateDeviceRequest) (*proto.CreateDeviceResponse, error)
func (*GRPCServer) DevicePrint ¶
func (m *GRPCServer) DevicePrint(ctx context.Context, req *proto.DevicePrintRequest) (*proto.DevicePrintResponse, error)
func (*GRPCServer) DeviceSetValue ¶
func (m *GRPCServer) DeviceSetValue(ctx context.Context, req *proto.DeviceSetValueRequest) ( *proto.DeviceSetValueResponse, error)
func (*GRPCServer) DeviceValue ¶
func (m *GRPCServer) DeviceValue(ctx context.Context, req *proto.DeviceValueRequest) (*proto.DeviceValueResponse, error)
func (*GRPCServer) FreeDevice ¶
func (m *GRPCServer) FreeDevice(ctx context.Context, req *proto.FreeDeviceRequest) (*proto.FreeDeviceResponse, error)
func (*GRPCServer) GetDevice ¶
func (m *GRPCServer) GetDevice(ctx context.Context, req *proto.GetDeviceRequest) (*proto.GetDeviceResponse, error)
Click to show internal directories.
Click to hide internal directories.