plugins

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2023 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartPlugins added in v0.0.2

func StartPlugins() error

Types

type Device added in v0.0.2

type Device interface {
	Register() error
	Initialize(settings map[string]interface{})
}

type DevicePlugin added in v0.0.2

type DevicePlugin struct {
	// Impl Injection
	Impl Device
}

This is the implementation of plugin.Plugin so we can serve/consume this

This has two methods: Server must return an RPC server for this plugin type. We construct a GreeterRPCServer for this.

Client must return an implementation of our interface that communicates over an RPC client. We return GreeterRPC for this.

Ignore MuxBroker. That is used to create more multiplexed streams on our plugin connection and is a more advanced use case.

func (DevicePlugin) Client added in v0.0.2

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

func (*DevicePlugin) Server added in v0.0.2

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

type DeviceRPC added in v0.0.2

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

Here is an implementation that talks over RPC

func (*DeviceRPC) Greet added in v0.0.2

func (g *DeviceRPC) Greet() string

type DeviceRPCServer added in v0.0.2

type DeviceRPCServer struct {
	// This is the real implementation
	Impl Device
}

Here is the RPC server that GreeterRPC talks to, conforming to the requirements of net/rpc

func (*DeviceRPCServer) Greet added in v0.0.2

func (s *DeviceRPCServer) Greet(args interface{}, resp *string) error

Jump to

Keyboard shortcuts

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