shared

package
v0.0.0-...-45eb8e3 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

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 RPCPlugin so that this plugin can be served.

func (*DevicePlugin) Client

func (p *DevicePlugin) Client(_ *plugin.MuxBroker, c *rpc.Client) (interface{}, error)

func (*DevicePlugin) Server

func (p *DevicePlugin) Server(*plugin.MuxBroker) (interface{}, error)

type RPCClient

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

func (*RPCClient) CreateDevice

func (m *RPCClient) CreateDevice() (uint64, error)

func (*RPCClient) DevicePrint

func (m *RPCClient) DevicePrint(ptr uint64) error

func (*RPCClient) DeviceSetValue

func (m *RPCClient) DeviceSetValue(ptr uint64, value int32) error

func (*RPCClient) DeviceValue

func (m *RPCClient) DeviceValue(ptr uint64) (int32, error)

func (*RPCClient) FreeDevice

func (m *RPCClient) FreeDevice(ptr uint64) error

func (*RPCClient) GetDevice

func (m *RPCClient) GetDevice(ptr uint64, useJson bool) ([]byte, error)

type RPCServer

type RPCServer struct {
	Impl Device
}

func (*RPCServer) CreateDevice

func (m *RPCServer) CreateDevice(_ interface{}, resp *uint64) error

func (*RPCServer) DevicePrint

func (m *RPCServer) DevicePrint(ptr uint64, _ *struct{}) error

func (*RPCServer) DeviceSetValue

func (m *RPCServer) DeviceSetValue(req *proto.DeviceSetValueRequest, _ *struct{}) error

func (*RPCServer) DeviceValue

func (m *RPCServer) DeviceValue(ptr uint64, resp *int32) error

func (*RPCServer) FreeDevice

func (m *RPCServer) FreeDevice(ptr uint64, _ *struct{}) error

func (*RPCServer) GetDevice

func (m *RPCServer) GetDevice(req *proto.GetDeviceRequest, resp *[]byte) error

Jump to

Keyboard shortcuts

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