laniakea_sdk

package module
v0.0.0-...-523022b Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: MIT Imports: 8 Imported by: 3

README

Laniakea Plugin SDK

Repository for Laniakea Plugin SDKs in various coding languages

Examples

Examples in Go and Python can be found in the examples repository

Python

To create python plugins, install the following dependencies

$ pip install grpcio grpcio-tools grpcio-health-checking laniakea-plugin-sdk pyinstaller

Once you've created a plugin, you must create an executable in order for Laniakea to run the plugin

$ pyinstaller -F plugin.py

Documentation

Index

Constants

View Source
const (
	ErrPluginVersionNotSet     = bg.Error("plugin version not set")
	ErrLaniakeaVersionMismatch = bg.Error("plugin requires a different version of laniakea")
)

Variables

View Source
var (
	HandshakeConfig = plugin.HandshakeConfig{
		ProtocolVersion:  1,
		MagicCookieKey:   "LANIAKEA_PLUGIN_MAGIC_COOKIE",
		MagicCookieValue: "a56e5daaa516e17d3d4b3d4685df9f8ca59c62c2d818cd5a7df13c039f134e16",
	}
)

Functions

This section is empty.

Types

type Controller

type Controller interface {
	Stop() error
	Command(*proto.Frame) (chan *proto.Frame, error)
	PushVersion(versionNumber string) error // This method pushes the version of Laniakea to the plugin. Plugin can then specify a minimum version of laniakea to run properly
	GetVersion() (string, error)            // This method gets the version number from the plugin. Needed if plugins rely on other plugins and specific versions are needed
}

Controller interface describes an interface for plugins which produce data but also act as controllers

type ControllerBase

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

ControllerBase is a rough implementation of the Controller interface It implements the PushVersion and GetVersion functions for convenience

func (*ControllerBase) GetLaniVersion

func (b *ControllerBase) GetLaniVersion() string

GetLaniVersion returns the version of laniakea

func (*ControllerBase) GetVersion

func (b *ControllerBase) GetVersion() (string, error)

GetVersion returns the current plugin version if it has been set

func (*ControllerBase) PushVersion

func (b *ControllerBase) PushVersion(versionNumber string) error

PushVersion sets the required laniakea version

func (*ControllerBase) SetPluginVersion

func (b *ControllerBase) SetPluginVersion(verStr string)

SetPluginVersion sets the plugin version string

func (*ControllerBase) SetVersionConstraints

func (b *ControllerBase) SetVersionConstraints(verStr string) error

SetVersionConstraints sets the version constraints on Laniakea

type ControllerGRPCClient

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

func (*ControllerGRPCClient) Command

func (c *ControllerGRPCClient) Command(f *proto.Frame) (chan *proto.Frame, error)

Command implements the Controller interface method Command

func (*ControllerGRPCClient) GetVersion

func (c *ControllerGRPCClient) GetVersion() (string, error)

GetVersion implements the Controller interface method GetVersion

func (*ControllerGRPCClient) PushVersion

func (c *ControllerGRPCClient) PushVersion(versionNumber string) error

PushVersion implements the Controller interface method PushVersion

func (*ControllerGRPCClient) Stop

func (c *ControllerGRPCClient) Stop() error

Stop implements the Controller interface method Stop

type ControllerGRPCServer

type ControllerGRPCServer struct {
	proto.UnimplementedControllerServer
	Impl Controller
}

func (*ControllerGRPCServer) Command

Command implements the Controller gRPC server interface

func (*ControllerGRPCServer) GetVersion

GetVersion implements the Controller gRPC server interface

func (*ControllerGRPCServer) PushVersion

func (s *ControllerGRPCServer) PushVersion(ctx context.Context, req *proto.VersionNumber) (*proto.Empty, error)

PushVersion implements the Controller gRPC server interface

func (*ControllerGRPCServer) Stop

Stop implements the Controller gRPC server interface

type ControllerPlugin

type ControllerPlugin struct {
	plugin.Plugin
	Impl Controller
}

func (*ControllerPlugin) GRPCClient

func (p *ControllerPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

GRPCClient implements the plugin.Plugin interface in the go-plugin package

func (*ControllerPlugin) GRPCServer

func (p *ControllerPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

GRPCServer implements the plugin.Plugin interface in the go-plugin package

type Datasource

type Datasource interface {
	StartRecord() (chan *proto.Frame, error)
	StopRecord() error
	Stop() error
	PushVersion(versionNumber string) error // This method pushes the version of Laniakea to the plugin. Plugin can then specify a minimum version of laniakea to run properly
	GetVersion() (string, error)            // This method gets the version number from the plugin. Needed if plugins rely on other plugins and specific versions are needed
}

Datasource interface describes an interface for plugins which will only produce streams of data

type DatasourceBase

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

DatasourceBase is a rough implementation of the Datasource interface It implements the PushVersion and GetVersion functions for convenience

func (*DatasourceBase) GetLaniVersion

func (b *DatasourceBase) GetLaniVersion() string

GetLaniVersion returns the version of laniakea

func (*DatasourceBase) GetVersion

func (b *DatasourceBase) GetVersion() (string, error)

GetVersion returns the current plugin version if it has been set

func (*DatasourceBase) PushVersion

func (b *DatasourceBase) PushVersion(versionNumber string) error

PushVersion sets the laniakea version atrribute

func (*DatasourceBase) SetPluginVersion

func (b *DatasourceBase) SetPluginVersion(verStr string)

SetPluginVersion sets the plugin version string

func (*DatasourceBase) SetVersionConstraints

func (b *DatasourceBase) SetVersionConstraints(verStr string) error

SetVersionConstraints sets the version constraints on Laniakea

type DatasourceGRPCClient

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

func (*DatasourceGRPCClient) GetVersion

func (c *DatasourceGRPCClient) GetVersion() (string, error)

GetVersion implements the Datasource interface method GetVersion

func (*DatasourceGRPCClient) PushVersion

func (c *DatasourceGRPCClient) PushVersion(versionNumber string) error

PushVersion implements the Datasource interface method PushVersion

func (*DatasourceGRPCClient) StartRecord

func (c *DatasourceGRPCClient) StartRecord() (chan *proto.Frame, error)

StartRecord implements the Datasource interface method StartRecord

func (*DatasourceGRPCClient) Stop

func (c *DatasourceGRPCClient) Stop() error

Stop implements the Datasource interface method Stop

func (*DatasourceGRPCClient) StopRecord

func (c *DatasourceGRPCClient) StopRecord() error

StopRecord implements the Datasource interface method StopRecord

type DatasourceGRPCServer

type DatasourceGRPCServer struct {
	proto.UnimplementedDatasourceServer
	Impl Datasource
}

func (*DatasourceGRPCServer) GetVersion

GetVersion implements the Datsource gRPC server interface

func (*DatasourceGRPCServer) PushVersion

func (s *DatasourceGRPCServer) PushVersion(ctx context.Context, req *proto.VersionNumber) (*proto.Empty, error)

PushVersion implements the Datasource gRPC server interface

func (*DatasourceGRPCServer) StartRecord

StartRecord implements the Datasource gRPC server interface

func (*DatasourceGRPCServer) Stop

Stop implements the Datasource gRPC server interface

func (*DatasourceGRPCServer) StopRecord

func (s *DatasourceGRPCServer) StopRecord(ctx context.Context, _ *proto.Empty) (*proto.Empty, error)

StopRecord implements the Datasource gRPC server interface

type DatasourcePlugin

type DatasourcePlugin struct {
	plugin.Plugin
	Impl Datasource
}

func (*DatasourcePlugin) GRPCClient

func (p *DatasourcePlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

GRPCClient implements the plugin.Plugin interface in the go-plugin package

func (*DatasourcePlugin) GRPCServer

func (p *DatasourcePlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

GRPCServer implements the plugin.Plugin interface in the go-plugin package

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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