Documentation ¶
Index ¶
- type GRPCClient
- type Plugin
- func (p *Plugin) Close()
- func (p *Plugin) Execute(j *gaia.Job) error
- func (p *Plugin) FlushLogs() error
- func (p *Plugin) GetJobs() ([]gaia.Job, error)
- func (p *Plugin) Init(command *exec.Cmd, logPath *string) error
- func (p *Plugin) NewPlugin(ca security.CAAPI) scheduler.Plugin
- func (p *Plugin) Validate() error
- type PluginGRPC
- type PluginGRPCImpl
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) Init ¶ added in v0.2.2
Init prepares the log path, set's up new certificates for both gaia and plugin, and prepares the go-plugin client.
It expects the start command for the plugin and the path where the log file should be stored.
It's up to the caller to call plugin.Close to shutdown the plugin and close the gRPC connection.
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).