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 2bb74de
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
1 change: 1 addition & 0 deletions commands/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Context struct {
Online bool
ConfigRoot string
ReqLog *ReqLog

Plugins *loader.PluginLoader

config *config.Config
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
12 changes: 1 addition & 11 deletions plugin/loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,4 @@ 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 2bb74de

Please sign in to comment.