Documentation
¶
Overview ¶
Package plugin provides the ability to load plugins
Package plugin provides the ability to load plugins
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultBrokers = map[string]func(...broker.Option) broker.Broker{ "stack.rpc.broker": brokerSrv.NewBroker, "service": brokerSrv.NewBroker, "http": http.NewBroker, "memory": memory.NewBroker, "nats": nats.NewBroker, } DefaultClients = map[string]func(...client.Option) client.Client{ "rpc": cmucp.NewClient, "mucp": cmucp.NewClient, "grpc": cgrpc.NewClient, } DefaultRegistries = map[string]func(...registry.Option) registry.Registry{ "stack.rpc.registry": regSrv.NewRegistry, "service": regSrv.NewRegistry, "mdns": mdns.NewRegistry, "memory": rmem.NewRegistry, } DefaultSelectors = map[string]func(...selector.Option) selector.Selector{ "default": selectorR.NewSelector, "dns": dns.NewSelector, "cache": selectorR.NewSelector, "router": router.NewSelector, "static": static.NewSelector, } DefaultServers = map[string]func(...server.Option) server.Server{ "rpc": smucp.NewServer, "mucp": smucp.NewServer, "grpc": sgrpc.NewServer, } DefaultTransports = map[string]func(...transport.Option) transport.Transport{ "memory": tmem.NewTransport, "http": thttp.NewTransport, "grpc": tgrpc.NewTransport, "quic": quic.NewTransport, } )
View Source
var ( // Default plugin loader DefaultPlugin = NewPlugin() )
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Name of the plugin e.g rabbitmq
Name string
// Type of the plugin e.g broker
Type string
// Path specifies the import path
Path string
// NewFunc creates an instance of the plugin
NewFunc interface{}
}
Config is the plugin config
type Plugin ¶
type Plugin interface {
// Initialise a plugin with the config
Init(c *Config) error
// Load loads a .so plugin at the given path
Load(path string) (*Config, error)
// Build a .so plugin with config at the path specified
Build(path string, c *Config) error
}
Plugin is a plugin loaded from a file
Click to show internal directories.
Click to hide internal directories.