core

package
v0.0.1-pre.5 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Handshake = goplugin.HandshakeConfig{

	ProtocolVersion:  1,
	MagicCookieKey:   "JACKADI_PLUGIN_MAGIC_COOKIE",
	MagicCookieValue: "hv43fBvWLYYm0FWmur3V5KmJQXPR0woBg2F2MbyAcE8UuSCQGTlFJvTQUncCY0Xm",
}

Handshake is a common handshake that is shared by plugin and host.

Functions

func StructpbValueToInput

func StructpbValueToInput(value any, targetType reflect.Type) (any, error)

Types

type GRPCClient

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

func (*GRPCClient) CollectSpecs

func (c *GRPCClient) CollectSpecs(ctx context.Context) ([]byte, error)

func (*GRPCClient) Do

func (c *GRPCClient) Do(ctx context.Context, task string, input *proto.Input) (Response, error)

func (*GRPCClient) GetTaskLockMode

func (c *GRPCClient) GetTaskLockMode(task string) (proto.LockMode, error)

func (*GRPCClient) Help

func (c *GRPCClient) Help(task string) (map[string]string, error)

func (*GRPCClient) Name

func (c *GRPCClient) Name() (string, error)

func (*GRPCClient) Tasks

func (c *GRPCClient) Tasks() ([]string, error)

func (*GRPCClient) Version

func (c *GRPCClient) Version() (Version, error)

type GRPCServer

type GRPCServer struct {
	Impl Plugin
}

func (*GRPCServer) CollectSpecs

func (s *GRPCServer) CollectSpecs(ctx context.Context, req *empty.Empty) (*protoplugin.CollectSpecsResponse, error)

func (*GRPCServer) Do

func (*GRPCServer) Help

func (*GRPCServer) Name

func (*GRPCServer) Tasks

func (*GRPCServer) Version

type HCPlugin

type HCPlugin struct {
	goplugin.Plugin
	Impl Plugin
}

func (*HCPlugin) GRPCClient

func (*HCPlugin) GRPCClient(ctx context.Context, broker *goplugin.GRPCBroker, c *grpc.ClientConn) (any, error)

func (*HCPlugin) GRPCServer

func (p *HCPlugin) GRPCServer(broker *goplugin.GRPCBroker, s *grpc.Server) error

type Plugin

type Plugin interface {
	Name() (string, error)
	Tasks() ([]string, error)
	Help(task string) (map[string]string, error)
	Version() (Version, error)
	Do(ctx context.Context, task string, input *proto.Input) (Response, error)
	CollectSpecs(ctx context.Context) ([]byte, error)
	GetTaskLockMode(task string) (proto.LockMode, error)
}

type Response

type Response struct {
	Output  []byte
	Error   string
	Retcode int32
}

type Version

type Version struct {
	PluginVersion string
	Commit        string
	BuildTime     string
	GoVersion     string
}

func (Version) String

func (v Version) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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