plugin

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginName             = "plugin"
	DefaultProtocolVersion = 1
)

Variables

View Source
var Handshake = p.HandshakeConfig{
	ProtocolVersion: DefaultProtocolVersion,

	MagicCookieKey:   "RUN_PLUGIN_MAGIC_COOKIE",
	MagicCookieValue: "iaafij5485d5utqh",
}

Handshake is configuring the handshake for the gRPC client.

View Source
var VersionedPlugins = map[int]p.PluginSet{
	1: {
		"plugin": &GRPCProviderPlugin{},
	},
}

Functions

func Plugin

func Plugin(ctx context.Context, path string, args ...string) htmx.Node

Plugin ...

func Serve

func Serve(opts *ServeOpts)

Serve ...

Types

type Factory

type Factory func() (*GRPCPlugin, error)

Factory is creatig a new instance of the plugin.

type GRPCPlugin

type GRPCPlugin struct {
	PluginClient *p.Client
	Meta         *Meta
	// contains filtered or unexported fields
}

GRPCPlugin contains the configuration and the client connection for the provider Plugin.

func (*GRPCPlugin) Close

func (p *GRPCPlugin) Close() error

Close is closing the gRPC connection if a plugin is configured.

func (*GRPCPlugin) Render

func (p *GRPCPlugin) Render(ctx context.Context) (string, error)

Render is rendering the plugin with the provided app and options.

type GRPCPluginFunc

type GRPCPluginFunc func() proto.PluginServer

GRPCPluginFunc ...

type GRPCProviderPlugin

type GRPCProviderPlugin struct {
	p.Plugin
	GRPCPlugin func() proto.PluginServer
}

GRPCProviderPlugin ...

func (*GRPCProviderPlugin) GRPCClient

func (p *GRPCProviderPlugin) GRPCClient(_ context.Context, _ *p.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

GRPCClient ...

func (*GRPCProviderPlugin) GRPCServer

func (p *GRPCProviderPlugin) GRPCServer(_ *p.GRPCBroker, s *grpc.Server) error

type Meta

type Meta struct {
	// Path ...
	Path string
	// Arguments ...
	Arguments []string
}

Meta are the meta information provided for the plugin. These are the arguments and the path to the plugin.

func (*Meta) ExecutableFile

func (m *Meta) ExecutableFile() (string, error)

ExecutableFile ...

func (*Meta) Factory

func (m *Meta) Factory(ctx context.Context) Factory

Factory returns a factory function that can be used to create a new instance of the plugin.

type ServeOpts

type ServeOpts struct {
	GRPCPluginFunc GRPCPluginFunc
}

ServeOpts ...

Jump to

Keyboard shortcuts

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