Documentation ¶
Index ¶
Constants ¶
View Source
const ( // StorageDriverPlugin the storage driver plugin type. StorageDriverPlugin = PluginType("storagedriver") // StorageManagerPlugin the storage manager plugin type StorageManagerPlugin = PluginType("storagemanager") )
Variables ¶
View Source
var PluginTypes = []PluginType{ StorageDriverPlugin, StorageManagerPlugin, }
PluginTypes explicitly stores all available plugin types.
Functions ¶
func Initialize ¶
func Initialize(plugins map[PluginType][]*PluginProperties) error
Initialize builds all plugins defined in config file.
func RegisterPluginBuilder ¶
func RegisterPluginBuilder(pt PluginType, name string, builder Builder) error
RegisterPluginBuilder register a plugin builder that will be called to create a new plugin instant when cdn starts.
Types ¶
type Manager ¶
type Manager interface { // AddBuilder adds a Builder object with the giving plugin type and name. AddBuilder(pt PluginType, name string, b Builder) error // GetBuilder returns a Builder object with the giving plugin type and name. GetBuilder(pt PluginType, name string) (Builder, bool) // DeleteBuilder deletes a builder with the giving plugin type and name. DeleteBuilder(pt PluginType, name string) // AddPlugin adds a plugin into this manager. AddPlugin(p Plugin) error // GetPlugin returns a plugin with the giving plugin type and name. GetPlugin(pt PluginType, name string) (Plugin, bool) // DeletePlugin deletes a plugin with the giving plugin type and name. DeletePlugin(pt PluginType, name string) }
Manager manages all plugin builders and plugin instants.
type Plugin ¶
type Plugin interface { // Type returns the type of this plugin. Type() PluginType // Name returns the name of this plugin. Name() string }
Plugin defines methods that plugins need to implement.
type PluginProperties ¶
type PluginProperties struct { Name string `yaml:"name" mapstructure:"name"` Enable bool `yaml:"enable" mapstructure:"enable"` Config interface{} `yaml:"config" mapstructure:"config"` }
PluginProperties the properties of a plugin.
type Repository ¶
type Repository interface { // Add adds a data to this repository. Add(pt PluginType, name string, data interface{}) error // Get gets a data with the giving type and name from this // repository. Get(pt PluginType, name string) (interface{}, bool) // Delete deletes a data with the giving type and name from // this repository. Delete(pt 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.