Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Initialize ¶
Initialize builds all plugins defined in config file.
func RegisterPlugin ¶
func RegisterPlugin(pt config.PluginType, name string, builder Builder)
RegisterPlugin register a plugin builder that will be called to create a new plugin instant when supernode starts.
func SetManager ¶
func SetManager(m Manager)
SetManager sets a Manager implementation instead of the default one.
Types ¶
type Manager ¶
type Manager interface {
// GetBuilder adds a Builder object with the giving plugin type and name.
AddBuilder(pt config.PluginType, name string, b Builder)
// GetBuilder returns a Builder object with the giving plugin type and name.
GetBuilder(pt config.PluginType, name string) Builder
// DeleteBuilder deletes a builder with the giving plugin type and name.
DeleteBuilder(pt config.PluginType, name string)
// AddPlugin adds a plugin into this manager.
AddPlugin(p Plugin)
// GetPlugin returns a plugin with the giving plugin type and name.
GetPlugin(pt config.PluginType, name string) Plugin
// DeletePlugin deletes a plugin with the giving plugin type and name.
DeletePlugin(pt config.PluginType, name string)
}
Manager manages all plugin builders and plugin instants.
type Plugin ¶
type Plugin interface {
// Type returns the type of this plugin.
Type() config.PluginType
// Name returns the name of this plugin.
Name() string
}
Plugin defines methods that plugins need to implement.
type Repository ¶
type Repository interface {
// Add adds a data to this repository.
Add(pt config.PluginType, name string, data interface{})
// Get gets a data with the giving type and name from this
// repository.
Get(pt config.PluginType, name string) interface{}
// Delete deletes a data with the giving type and name from
// this repository.
Delete(pt config.PluginType, name string)
}
Repository stores data related to plugin.
func NewRepository ¶
func NewRepository() Repository
NewRepository creates a default repository instant.
Click to show internal directories.
Click to hide internal directories.