Documentation
¶
Index ¶
- func BuildProtocol(opt *ProtocolOption) caller.Builder
- type GoPlugin
- type HostPlugins
- type InstallationOptions
- type Option
- func WithCustomConfigChecker(adapters ...discover.Checker) Option
- func WithCustomConfigParser(parserAdapter discover.Parser, sourceAdapter discover.SourceReader) Option
- func WithCustomIdentityChecker(adapter host.IdentityChecker) Option
- func WithCustomProcess(runner process.Runner, processes process.ProcessesBuilder) Option
- type PluginConf
- type PluginMapper
- type PluginSupervisor
- func (s *PluginSupervisor) AutoRestart(payload *supervisor.Payload)
- func (s *PluginSupervisor) Handle()
- func (s *PluginSupervisor) OnError(event *supervisor.Payload, handlers ...supervisor.OnErrorHandler)
- func (s *PluginSupervisor) Setup(handlers ...supervisor.OnErrorHandler) error
- func (s *PluginSupervisor) Shutdown()
- func (s *PluginSupervisor) Start() *PluginSupervisor
- func (s *PluginSupervisor) Watch() <-chan *supervisor.Payload
- type PluginSupervisorOption
- type ProtocolOption
- type Registry
- func (r *Registry) GetAllPlugins() ([]*HostPlugins, error)
- func (r *Registry) GetCaller(host, plugin string) (*caller.Plugin, error)
- func (r *Registry) GetContainer(host string) (*executor.Container, error)
- func (r *Registry) GetHostPluginInstance(host string) (*GoPlugin, error)
- func (r *Registry) GetPID(hostName, pluginName string) (process.ID, error)
- func (r *Registry) Install(options *InstallationOptions) (*Registry, error)
- func (r *Registry) KillPlugins()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildProtocol ¶
func BuildProtocol(opt *ProtocolOption) caller.Builder
BuildProtocol a helper to check and also generate a default protocol should be used like a REST or GRPC
Types ¶
type GoPlugin ¶
type GoPlugin struct {
// contains filtered or unexported fields
}
GoPlugin used as main struct to store goplugin's state
func New ¶
New used to create new instance of GoPlugin, you can provide customization here by giving goplugin.Option
func (*GoPlugin) Build ¶
Build used to compile current host instance into consumed state of host.Builder
func (*GoPlugin) GetPluginConf ¶
func (g *GoPlugin) GetPluginConf(pluginName string) (*PluginConf, error)
GetPluginConf used to get plugin's config
func (*GoPlugin) GetProcessInstance ¶
GetProcessInstance .
func (*GoPlugin) SetupPlugin ¶
func (g *GoPlugin) SetupPlugin(plugins ...PluginMapper) *GoPlugin
SetupPlugin used to store host plugin's configurations
type HostPlugins ¶
HostPlugins used to store all plugins from some host
type InstallationOptions ¶
type InstallationOptions struct {
RetryTimeoutCaller int
}
InstallationOptions used to store any options on install
type Option ¶
type Option func(*GoPlugin)
Option used to customize default objects
func WithCustomConfigChecker ¶
WithCustomConfigChecker used to customize config checker, the parameter must be implement discover.Checker
func WithCustomConfigParser ¶
func WithCustomConfigParser(parserAdapter discover.Parser, sourceAdapter discover.SourceReader) Option
WithCustomConfigParser used to customize config reader & parser, given adapters must be implement discover.Parser and discover.SourceReader interfaces
func WithCustomIdentityChecker ¶
func WithCustomIdentityChecker(adapter host.IdentityChecker) Option
WithCustomIdentityChecker used to customize plugin's identity checker, given adapter must implement host.IdentityChecker
func WithCustomProcess ¶
func WithCustomProcess(runner process.Runner, processes process.ProcessesBuilder) Option
WithCustomProcess used to customize process runner and process data builder (including registry)
type PluginConf ¶
type PluginConf struct {
Protocol *ProtocolOption
}
PluginConf used to store plugin's configurations
type PluginMapper ¶
type PluginMapper map[string]*PluginConf
PluginMapper used as registry to store plugin's config
func Map ¶
func Map(pluginName string, conf *PluginConf) PluginMapper
Map used to put a plugin and assign it with their spesific configurations
type PluginSupervisor ¶
type PluginSupervisor struct {
// contains filtered or unexported fields
}
PluginSupervisor is main struct used to store supervisor's configurations
func Supervisor ¶
func Supervisor(pluggable *Registry, options ...PluginSupervisorOption) *PluginSupervisor
Supervisor used to supervisor all available plugins from all hosts
func (*PluginSupervisor) AutoRestart ¶
func (s *PluginSupervisor) AutoRestart(payload *supervisor.Payload)
AutoRestart used to restart plugin's process if cannot be reached or something went wrong
func (*PluginSupervisor) Handle ¶
func (s *PluginSupervisor) Handle()
Handle used start error handling
func (*PluginSupervisor) OnError ¶
func (s *PluginSupervisor) OnError(event *supervisor.Payload, handlers ...supervisor.OnErrorHandler)
OnError implement supervisor.Driver interface
func (*PluginSupervisor) Setup ¶
func (s *PluginSupervisor) Setup(handlers ...supervisor.OnErrorHandler) error
Setup build a registry for host and their plugin and their plugin's caller and creating new supervisor's instance
func (*PluginSupervisor) Shutdown ¶
func (s *PluginSupervisor) Shutdown()
Shutdown should be used on defer's way, it will should be automatically shutting down main supervisor's ticker
func (*PluginSupervisor) Start ¶
func (s *PluginSupervisor) Start() *PluginSupervisor
Start used to start main supervisor process
func (*PluginSupervisor) Watch ¶
func (s *PluginSupervisor) Watch() <-chan *supervisor.Payload
Watch implement supervisor.Driver interface
type PluginSupervisorOption ¶
type PluginSupervisorOption func(*PluginSupervisor)
PluginSupervisorOption used to customize supervisor values
func SupervisorOptionCustomDriver ¶
func SupervisorOptionCustomDriver(drv supervisor.Driver) PluginSupervisorOption
SupervisorOptionCustomDriver used to setup custom driver, by default will use current PluginSupervisor as driver
func SupervisorOptionInterval ¶
func SupervisorOptionInterval(interval int) PluginSupervisorOption
SupervisorOptionInterval setup interval
type ProtocolOption ¶
type ProtocolOption struct {
RESTOpts *driver.RESTOptions
GRPCOpts *driver.GrpcOptions
}
ProtocolOption used to configure rest or grpc options You have to choose between rest or grpc, if your plugin using rest, than ignore grpc option, and vice versa, but you can't ignore them both
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry used as wrapper of executor object
func (*Registry) GetAllPlugins ¶
func (r *Registry) GetAllPlugins() ([]*HostPlugins, error)
GetAllPlugins used to get all plugins from all hosts
func (*Registry) GetCaller ¶
GetCaller plugin's caller instance. If plugin not started yet, this step will also run the plugin via os subprocess, before using this method you have to make sure that all hosts has been installed
func (*Registry) GetContainer ¶
GetContainer used to get container from executor instance based on hosts
func (*Registry) GetHostPluginInstance ¶
GetHostPluginInstance get GoPlugin instance based on host
func (*Registry) Install ¶
func (r *Registry) Install(options *InstallationOptions) (*Registry, error)
Install used to install available hostPlugins by calling Build
func (*Registry) KillPlugins ¶
func (r *Registry) KillPlugins()
KillPlugins used to kill all plugins from all installed hosts