Documentation ¶
Index ¶
- Variables
- func LoadSymbol(so, name string) (interface{}, error)
- func Reload(so, name string, vPtr interface{}) error
- func ReloadFromPlugin(p *plugin.Plugin, name string, vPtr interface{}) error
- type Glean
- func (g *Glean) Close()
- func (g *Glean) FindAllPlugins(t reflect.Type) ([]string, error)
- func (g *Glean) GetObjectByID(id string) (v interface{})
- func (g *Glean) GetSymbolByID(id string) (v interface{}, err error)
- func (g *Glean) LoadConfig() (err error)
- func (g *Glean) Reload(id string, vPtr interface{}) error
- func (g *Glean) ReloadAndWatch(id string, vPtr interface{}) error
- func (g *Glean) Watch(id string, vPtr interface{})
- type PluginItem
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrItemHasNotConfigured the plugin item has not been configured. ErrItemHasNotConfigured = errors.New("pluginItem is not configured") // ErrClosed glean instance has been closed. ErrClosed = errors.New("glean has been closed") // ErrValueCanNotSet the object can not be set. See https://golang.org/pkg/reflect/#Value.CanSet. ErrValueCanNotSet = errors.New("the object can't be addressable and can not be set") // ErrMustBePointer the object (function or variable) must be pointer. ErrMustBePointer = errors.New("the function or variable must be pointer") )
Functions ¶
func LoadSymbol ¶
LoadSymbol loads a plugin and gets the symbol. It encapsulates plugin.Open and plugin.Lookup methods to a convenient function. so is file path of the plugin and name is the symbol.
Types ¶
type Glean ¶
type Glean struct {
// contains filtered or unexported fields
}
Glean is a manager that manages all configured plugins and reloaded objects.
func (*Glean) FindAllPlugins ¶
FindAllPlugins gets all IDs that implements interface t.
func (*Glean) GetObjectByID ¶
GetObjectByID gets the variable or function by ID.
func (*Glean) GetSymbolByID ¶
GetSymbolByID gets the variable or function by ID from cached plugin.
func (*Glean) LoadConfig ¶
LoadConfig loads plugins from the configured file.
func (*Glean) ReloadAndWatch ¶
ReloadAndWatch loads an variable or function from plugins and begin to watch.
type PluginItem ¶
type PluginItem struct { // File file path of this plugin. File string `json:"file"` // ID is an unique string for this item. ID string `json:"id"` // Name is name of the symbol. Notice id is unique but names may be duplicated in different plugins. Name string `json:"name"` // Version is version of the plugin for tracing and upgrade. Version string `json:"version"` // Cached points the opened plugin. Cached *plugin.Plugin `json:"-"` // contains filtered or unexported fields }
PluginItem is a configured item that can be reloaded.
Click to show internal directories.
Click to hide internal directories.