in plugin/setup.go [55:82]
func (c Config) loadPlugins() (chan pluginInfo, map[string]bool, error) {
var (
plugins = make(chan pluginInfo, MaxPluginSize) // use channel as plugin queue
// plugins' status. plugin key => {true: init done, false: init not done}.
status = make(map[string]bool)
)
for typ, factories := range c {
for name, cfg := range factories {
factory := Get(typ, name)
if factory == nil {
return nil, nil, fmt.Errorf("plugin %s:%s no registered or imported, do not configure", typ, name)
}
p := pluginInfo{
factory: factory,
typ: typ,
name: name,
cfg: cfg,
}
select {
case plugins <- p:
default:
return nil, nil, fmt.Errorf("plugin number exceed max limit:%d", len(plugins))
}
status[p.key()] = false
}
}
return plugins, status, nil
}