dkron: Index | Files

package plugin

import ""


Package Files

execution_processor.go executor.go plugin.go serve.go


const (
    ProcessorPluginName = "processor"
    ExecutorPluginName  = "executor"

The constants below are the names of the plugins that can be dispensed from the plugin server.


var Handshake = plugin.HandshakeConfig{
    ProtocolVersion:  1,
    MagicCookieKey:   "DKRON_PLUGIN_MAGIC_COOKIE",
    MagicCookieValue: "b29a76488b6f3ca7955c5f769b50641f0fcd88748d8cedecda313d516320ca19",

Handshake is the HandshakeConfig used to configure clients and servers.

var PluginMap = map[string]plugin.Plugin{
    "processor": &ExecutionProcessorPlugin{},
    "executor":  &ExecutorPlugin{},

PluginMap should be used by clients for the map of plugins.

func Serve Uses

func Serve(opts *ServeOpts)

Serve serves a plugin. This function never returns and should be the final function called in the main function of the plugin.

type ExecutionProcessor Uses

type ExecutionProcessor struct {
    Broker *plugin.MuxBroker
    Client *rpc.Client

Here is an implementation that talks over RPC

func (*ExecutionProcessor) Process Uses

func (e *ExecutionProcessor) Process(args *dkron.ExecutionProcessorArgs) dkron.Execution

The Process method that actually call the plugin Process method.

type ExecutionProcessorPlugin Uses

type ExecutionProcessorPlugin struct {
    Processor dkron.ExecutionProcessor

func (*ExecutionProcessorPlugin) Client Uses

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

func (*ExecutionProcessorPlugin) Server Uses

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

type ExecutionProcessorServer Uses

type ExecutionProcessorServer struct {
    // This is the real implementation
    Broker    *plugin.MuxBroker
    Processor dkron.ExecutionProcessor

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

func (*ExecutionProcessorServer) Process Uses

func (e *ExecutionProcessorServer) Process(args *dkron.ExecutionProcessorArgs, resp *dkron.Execution) error

type ExecutorClient Uses

type ExecutorClient struct {
    // contains filtered or unexported fields

Here is the gRPC client that GRPCClient talks to.

func (*ExecutorClient) Execute Uses

func (m *ExecutorClient) Execute(args *dkron.ExecuteRequest) (*dkron.ExecuteResponse, error)

type ExecutorPlugin Uses

type ExecutorPlugin struct {
    Executor dkron.Executor

This is the implementation of plugin.Plugin so we can serve/consume this. We also implement GRPCPlugin so that this plugin can be served over gRPC.

func (*ExecutorPlugin) GRPCClient Uses

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

func (*ExecutorPlugin) GRPCServer Uses

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

type ExecutorServer Uses

type ExecutorServer struct {
    // This is the real implementation
    Impl dkron.Executor

Here is the gRPC server that GRPCClient talks to.

func (ExecutorServer) Execute Uses

func (m ExecutorServer) Execute(ctx context.Context, req *dkron.ExecuteRequest) (*dkron.ExecuteResponse, error)

Execute is where the magic happens

type ServeOpts Uses

type ServeOpts struct {
    Processor dkron.ExecutionProcessor
    Executor  dkron.Executor

ServeOpts are the configurations to serve a plugin.

Package plugin imports 5 packages (graph) and is imported by 2 packages. Updated 2019-10-26. Refresh now. Tools for package owners.