shared

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const PluginGlob = "logproxy-filter-*"

PluginGlob is the glob pattern used to find plugins.

Variables

View Source
var Handshake = plugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "BASIC_PLUGIN",
	MagicCookieValue: "6656191c-a4af-48a7-934f-ed05cd91dcc8",
}

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

View Source
var PluginMap = map[string]plugin.Plugin{
	"filter": &FilterGRPCPlugin{},
}

PluginMap is the map of plugins we can dispense.

Functions

This section is empty.

Types

type Filter

type Filter interface {
	Filter(in logging.Resource) (out logging.Resource, drop bool, modified bool, err error)
}

type FilterGRPCClient

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

func (*FilterGRPCClient) Filter

type FilterGRPCPlugin

type FilterGRPCPlugin struct {
	// GRPCPlugin must still implement the Plugin interface
	plugin.Plugin
	// Concrete implementation, written in Go. This is only used for plugins
	// that are written in Go.
	Impl Filter
}

This is the implementation of plugin.GRPCPlugin so we can serve/consume this.

func (*FilterGRPCPlugin) GRPCClient

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

func (*FilterGRPCPlugin) GRPCServer

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

type FilterGRPCServer

type FilterGRPCServer struct {
	proto.UnimplementedFilterServer
	// This is the real implementation
	Impl Filter
}

Here is the gRPC server that FilterGRPCClient talks to.

func (*FilterGRPCServer) Filter

type Plugin

type Plugin struct {
	// Path and Args are the method used to invocate this plugin.
	// These are the only two values that need to be set manually. Once
	// these are set, call Load to load the plugin.
	Path string   `json:"path,omitempty"`
	Args []string `json:"args"`
	App  Filter
}

Plugin is a single plugin that has been loaded.

func (*Plugin) Load

func (p *Plugin) Load() error

Load loads the plugin specified by the Path and instantiates the other fields on this structure.

func (*Plugin) String

func (p *Plugin) String() string

type PluginManager

type PluginManager struct {
	// PluginDirs are the directories where plugins can be found.
	// Any plugins with the same types found later (higher index) will
	// override earlier (lower index) directories.
	PluginDirs []string
	// contains filtered or unexported fields
}

PluginManager is responsible for discovering and starting plugins.

func (*PluginManager) Discover

func (m *PluginManager) Discover() error

Discover will find all the available plugin binaries. Each time this is called it will override any previously discovered plugins.

func (*PluginManager) LoadAll

func (m *PluginManager) LoadAll() error

LoadAll will launch every plugin and add it to the CoreConfig given.

func (*PluginManager) Plugins

func (m *PluginManager) Plugins() []*Plugin

Plugins returns the loaded plugins.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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