plugin

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GRPCClient

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

GRPCClient represents gRPC client

func (*GRPCClient) ExecuteJob

func (m *GRPCClient) ExecuteJob(job *proto.Job) (*proto.JobResult, error)

ExecuteJob triggers the execution of the given job in the plugin.

func (*GRPCClient) GetJobs

func (m *GRPCClient) GetJobs() (proto.Plugin_GetJobsClient, error)

GetJobs requests all jobs from the plugin. We get a stream of proto.Job back.

type Plugin

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

Plugin represents a single plugin instance which uses gRPC to connect to exactly one plugin.

func (*Plugin) Close

func (p *Plugin) Close()

Close shutdown the plugin and kills the gRPC connection. Remember to call this when you call plugin.Connect.

func (*Plugin) Connect

func (p *Plugin) Connect(command *exec.Cmd, logPath *string) error

Connect prepares the log path, starts the plugin, initiates the gRPC connection and looks up the plugin. It's up to the caller to call plugin.Close to shutdown the plugin and close the gRPC connection.

It expects the start command for the plugin and the path where the log file should be stored.

func (*Plugin) Execute

func (p *Plugin) Execute(j *gaia.Job) error

Execute triggers the execution of one single job for the given plugin.

func (*Plugin) GetJobs

func (p *Plugin) GetJobs() ([]gaia.Job, error)

GetJobs receives all implemented jobs from the given plugin.

func (*Plugin) NewPlugin added in v0.2.1

func (p *Plugin) NewPlugin(ca security.CAAPI) scheduler.Plugin

NewPlugin creates a new instance of Plugin. One Plugin instance represents one connection to a plugin.

type PluginGRPC

type PluginGRPC interface {
	GetJobs() (proto.Plugin_GetJobsClient, error)
	ExecuteJob(job *proto.Job) (*proto.JobResult, error)
}

PluginGRPC is the Gaia plugin interface used for communication with the plugin.

type PluginGRPCImpl

type PluginGRPCImpl struct {
	Impl PluginGRPC

	plugin.NetRPCUnsupportedPlugin
}

PluginGRPCImpl represents the plugin implementation on client side.

func (*PluginGRPCImpl) GRPCClient

func (p *PluginGRPCImpl) GRPCClient(context context.Context, b *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

GRPCClient is the passing method for the gRPC client.

func (*PluginGRPCImpl) GRPCServer

func (p *PluginGRPCImpl) GRPCServer(b *plugin.GRPCBroker, s *grpc.Server) error

GRPCServer is needed here to implement hashicorp plugin.Plugin interface. Real implementation is in the plugin(s).

Jump to

Keyboard shortcuts

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