Skip to content

Commit

Permalink
Address last review
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Kacper Łukawski <[email protected]>
  • Loading branch information
PlayerWithoutName committed Apr 14, 2018
1 parent aea981a commit 8b45855
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
3 changes: 2 additions & 1 deletion commands/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ type Context struct {
Online bool
ConfigRoot string
ReqLog *ReqLog
Plugins *loader.PluginLoader

Plugins *loader.PluginLoader

config *config.Config
LoadConfig func(path string) (*config.Config, error)
Expand Down
10 changes: 6 additions & 4 deletions plugin/loader/initializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import (
ipld "gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format"
)

func initialize(plugins []plugin.Plugin) error {
for _, p := range plugins {
//Initialize all loaded plugins
func (loader *PluginLoader) Initialize() error {
for _, p := range loader.plugins {
err := p.Init()
if err != nil {
return err
Expand All @@ -19,8 +20,9 @@ func initialize(plugins []plugin.Plugin) error {
return nil
}

func run(plugins []plugin.Plugin) error {
for _, pl := range plugins {
//Run the plugins
func (loader *PluginLoader) Run() error {
for _, pl := range loader.plugins {
switch pl := pl.(type) {
case plugin.PluginIPLD:
err := runIPLDPlugin(pl)
Expand Down
10 changes: 0 additions & 10 deletions plugin/loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,3 @@ func NewPluginLoader(pluginDir string) (*PluginLoader, error) {

return loader, nil
}

// Initialize all the loaded plugins
func (loader *PluginLoader) Initialize() error {
return initialize(loader.plugins)
}

// Run all the loaded plugins
func (loader *PluginLoader) Run() error {
return run(loader.plugins)
}

0 comments on commit 8b45855

Please sign in to comment.