Documentation
¶
Index ¶
- type BelaurLogWriter
- type BelaurPlugin
- type BelaurPluginClient
- type BelaurPluginImpl
- type GoPlugin
- func (p *GoPlugin) Close()
- func (p *GoPlugin) Execute(j *belaur.Job) error
- func (p *GoPlugin) FlushLogs() error
- func (p *GoPlugin) GetJobs() ([]*belaur.Job, error)
- func (p *GoPlugin) Init(command *exec.Cmd, logPath *string) error
- func (p *GoPlugin) NewPlugin(ca security.CAAPI) Plugin
- func (p *GoPlugin) Validate() error
- type Plugin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BelaurLogWriter ¶
type BelaurLogWriter struct {
// contains filtered or unexported fields
}
BelaurLogWriter represents a concurrent safe log writer which can be shared with go-plugin.
func (*BelaurLogWriter) Flush ¶
func (g *BelaurLogWriter) Flush() error
Flush locks and flushes the underlying writer.
func (*BelaurLogWriter) Write ¶
func (g *BelaurLogWriter) Write(p []byte) (n int, err error)
Write locks and writes to the underlying writer.
func (*BelaurLogWriter) WriteString ¶
func (g *BelaurLogWriter) WriteString(s string) (int, error)
WriteString locks and passes on the string to write to the underlying writer.
type BelaurPlugin ¶
type BelaurPlugin interface { GetJobs() (proto.Plugin_GetJobsClient, error) ExecuteJob(job *proto.Job) (*proto.JobResult, error) }
BelaurPlugin is the Bhojpur Belaur plugin interface used for communication with the plugin.
type BelaurPluginClient ¶
type BelaurPluginClient struct {
// contains filtered or unexported fields
}
BelaurPluginClient represents gRPC client
func (*BelaurPluginClient) ExecuteJob ¶
ExecuteJob triggers the execution of the given job in the plugin.
func (*BelaurPluginClient) GetJobs ¶
func (m *BelaurPluginClient) GetJobs() (proto.Plugin_GetJobsClient, error)
GetJobs requests all jobs from the plugin. We get a stream of proto.Job back.
type BelaurPluginImpl ¶
type BelaurPluginImpl struct { Impl BelaurPlugin plugin.NetRPCUnsupportedPlugin }
BelaurPluginImpl represents the plugin implementation on client side.
func (*BelaurPluginImpl) GRPCClient ¶
func (p *BelaurPluginImpl) GRPCClient(context context.Context, b *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
GRPCClient is the passing method for the gRPC client.
func (*BelaurPluginImpl) GRPCServer ¶
func (p *BelaurPluginImpl) 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).
type GoPlugin ¶
type GoPlugin struct {
// contains filtered or unexported fields
}
GoPlugin represents a single plugin instance which uses gRPC to connect to exactly one plugin.
func (*GoPlugin) Close ¶
func (p *GoPlugin) Close()
Close shutdown the plugin and kills the gRPC connection. Remember to call this when you call plugin.Connect.
func (*GoPlugin) Init ¶
Init prepares the log path, set's up new certificates for both Bhojpur Belaur 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 Plugin ¶
type Plugin interface { // NewPlugin creates a new instance of plugin NewPlugin(ca security.CAAPI) Plugin // Init initializes the go-plugin client and generates a // new certificate pair for Bhojpur Belaur and the plugin/pipeline. Init(command *exec.Cmd, logPath *string) error // Validate validates the plugin interface. Validate() error // Execute executes one job of a pipeline. Execute(j *belaur.Job) error // GetJobs returns all real jobs from the pipeline. GetJobs() ([]*belaur.Job, error) // FlushLogs flushes the logs. FlushLogs() error // Close closes the connection and cleans open file writes. Close() }
Plugin represents the plugin implementation.