Documentation ¶
Index ¶
- type Core
- func (c *Core) Call(plugin, version, funcName string, args interface{}) (Result, error)
- func (c *Core) Opts() Options
- func (c *Core) Plugin(name, version string) (*PluginInfo, bool)
- func (c *Core) Plugins() []*PluginInfo
- func (c *Core) Serve() error
- func (c *Core) Shutdown()
- func (c *Core) ShutdownPlugin(plugin, version string) error
- func (c *Core) Status() Status
- func (c *Core) Token() string
- type DefaultHook
- func (d *DefaultHook) OnExecReq(c *Core, p *PluginInfo, id uint64, funcName string, args interface{})
- func (d *DefaultHook) OnExecResp(c *Core, p *PluginInfo, id uint64, t shared.CodecType, result interface{}, ...)
- func (d *DefaultHook) OnPluginLog(c *Core, p *PluginInfo, level shared.LogLevel, msg string)
- func (d *DefaultHook) OnPluginMount(_ *Core, p *PluginInfo)
- func (d *DefaultHook) OnPluginPing(c *Core, p *PluginInfo)
- func (d *DefaultHook) OnPluginUnmount(c *Core, p *PluginInfo, reason shared.UnbindReason, msg *string)
- type EmptyHook
- func (e EmptyHook) OnExecReq(_ *Core, _ *PluginInfo, _ uint64, _ string, _ interface{})
- func (e EmptyHook) OnExecResp(_ *Core, _ *PluginInfo, _ uint64, _ shared.CodecType, _ interface{}, _ error)
- func (e EmptyHook) OnPluginLog(_ *Core, _ *PluginInfo, _ shared.LogLevel, _ string)
- func (e EmptyHook) OnPluginMount(_ *Core, _ *PluginInfo)
- func (e EmptyHook) OnPluginPing(_ *Core, _ *PluginInfo)
- func (e EmptyHook) OnPluginUnmount(_ *Core, _ *PluginInfo, _ shared.UnbindReason, _ *string)
- type Hook
- type Interface
- type Option
- func WithExecReqChSize(size int) Option
- func WithExecTimeout(dur time.Duration) Option
- func WithHealthTimeout(dur time.Duration) Option
- func WithHooks(h Hook) Option
- func WithInterfaces(interfaces ...Interface) Option
- func WithLogLevel(level shared.LogLevel) Option
- func WithPort(port int) Option
- func WithServerOpts(opts ...grpc.ServerOption) Option
- type Options
- type PluginInfo
- type Result
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
func (*Core) Call ¶
Call blocks until the func is executed or timeout
args can be map[string]interface{} or []byte
func (*Core) Plugin ¶
func (c *Core) Plugin(name, version string) (*PluginInfo, bool)
Plugin returns the plugin info of the specified plugin
func (*Core) Plugins ¶
func (c *Core) Plugins() []*PluginInfo
Plugins returns the plugin info of all plugins
func (*Core) ShutdownPlugin ¶
type DefaultHook ¶
type DefaultHook struct {
// contains filtered or unexported fields
}
func (*DefaultHook) OnExecReq ¶
func (d *DefaultHook) OnExecReq(c *Core, p *PluginInfo, id uint64, funcName string, args interface{})
func (*DefaultHook) OnExecResp ¶
func (d *DefaultHook) OnExecResp(c *Core, p *PluginInfo, id uint64, t shared.CodecType, result interface{}, err error)
func (*DefaultHook) OnPluginLog ¶
func (d *DefaultHook) OnPluginLog(c *Core, p *PluginInfo, level shared.LogLevel, msg string)
func (*DefaultHook) OnPluginMount ¶
func (d *DefaultHook) OnPluginMount(_ *Core, p *PluginInfo)
func (*DefaultHook) OnPluginPing ¶
func (d *DefaultHook) OnPluginPing(c *Core, p *PluginInfo)
func (*DefaultHook) OnPluginUnmount ¶
func (d *DefaultHook) OnPluginUnmount(c *Core, p *PluginInfo, reason shared.UnbindReason, msg *string)
type EmptyHook ¶
type EmptyHook struct{}
func (EmptyHook) OnExecReq ¶
func (e EmptyHook) OnExecReq(_ *Core, _ *PluginInfo, _ uint64, _ string, _ interface{})
func (EmptyHook) OnExecResp ¶
func (EmptyHook) OnPluginLog ¶
func (EmptyHook) OnPluginMount ¶
func (e EmptyHook) OnPluginMount(_ *Core, _ *PluginInfo)
func (EmptyHook) OnPluginPing ¶
func (e EmptyHook) OnPluginPing(_ *Core, _ *PluginInfo)
func (EmptyHook) OnPluginUnmount ¶
func (e EmptyHook) OnPluginUnmount(_ *Core, _ *PluginInfo, _ shared.UnbindReason, _ *string)
type Hook ¶
type Hook interface { OnPluginMount(c *Core, p *PluginInfo) OnPluginUnmount(c *Core, p *PluginInfo, reason shared.UnbindReason, msg *string) // msg is optional OnPluginPing(c *Core, p *PluginInfo) OnPluginLog(c *Core, p *PluginInfo, level shared.LogLevel, msg string) OnExecReq(c *Core, p *PluginInfo, id uint64, funcName string, args interface{}) // args might be []byte or map[string]interface{} OnExecResp(c *Core, p *PluginInfo, id uint64, t shared.CodecType, result interface{}, err error) // result might be []byte or map[string]interface{} }
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithExecReqChSize ¶
WithExecReqChSize set the chan size, default is 0
func WithExecTimeout ¶
WithExecTimeout set the exec timeout, default is 10s
func WithHealthTimeout ¶
WithHealthTimeout set the HealthTimeout, default is 15s
plugins with intervals higher than this limit will be disconnected and removed
func WithInterfaces ¶
func WithLogLevel ¶
WithLogLevel set the log level, default is Info
func WithServerOpts ¶
func WithServerOpts(opts ...grpc.ServerOption) Option
type PluginInfo ¶
type PluginInfo struct {
// contains filtered or unexported fields
}
func (*PluginInfo) Funcs ¶
func (p *PluginInfo) Funcs() []string
func (*PluginInfo) Interface ¶
func (p *PluginInfo) Interface() string
Interface implemented by plugin
Click to show internal directories.
Click to hide internal directories.