From 49b4bf4965674e491913b8967f4813ca3b47a853 Mon Sep 17 00:00:00 2001 From: jkrvivian <jkrvivian@gmail.com> Date: Thu, 27 Feb 2020 13:54:57 +0800 Subject: [PATCH] feat: Bundle plugins in to group --- main.go | 59 +++++------------------------------ pluginmgr/core/plugins.go | 26 +++++++++++++++ pluginmgr/research/plugins.go | 14 +++++++++ pluginmgr/ui/plugins.go | 12 +++++++ pluginmgr/webapi/plugins.go | 26 +++++++++++++++ 5 files changed, 86 insertions(+), 51 deletions(-) create mode 100644 pluginmgr/core/plugins.go create mode 100644 pluginmgr/research/plugins.go create mode 100644 pluginmgr/ui/plugins.go create mode 100644 pluginmgr/webapi/plugins.go diff --git a/main.go b/main.go index 435ede0c..d510157c 100644 --- a/main.go +++ b/main.go @@ -4,25 +4,11 @@ import ( "net/http" _ "net/http/pprof" - "github.com/iotaledger/goshimmer/plugins/analysis" - "github.com/iotaledger/goshimmer/plugins/autopeering" - "github.com/iotaledger/goshimmer/plugins/banner" - "github.com/iotaledger/goshimmer/plugins/cli" + "github.com/iotaledger/goshimmer/pluginmgr/core" + "github.com/iotaledger/goshimmer/pluginmgr/research" + "github.com/iotaledger/goshimmer/pluginmgr/ui" + "github.com/iotaledger/goshimmer/pluginmgr/webapi" "github.com/iotaledger/goshimmer/plugins/config" - "github.com/iotaledger/goshimmer/plugins/gossip" - "github.com/iotaledger/goshimmer/plugins/gracefulshutdown" - "github.com/iotaledger/goshimmer/plugins/logger" - "github.com/iotaledger/goshimmer/plugins/metrics" - "github.com/iotaledger/goshimmer/plugins/portcheck" - "github.com/iotaledger/goshimmer/plugins/remotelog" - "github.com/iotaledger/goshimmer/plugins/spa" - "github.com/iotaledger/goshimmer/plugins/tangle" - "github.com/iotaledger/goshimmer/plugins/webapi" - webapi_broadcastData "github.com/iotaledger/goshimmer/plugins/webapi/broadcastData" - webapi_gtta "github.com/iotaledger/goshimmer/plugins/webapi/gtta" - webapi_spammer "github.com/iotaledger/goshimmer/plugins/webapi/spammer" - webapi_auth "github.com/iotaledger/goshimmer/plugins/webauth" - "github.com/iotaledger/hive.go/node" ) @@ -32,38 +18,9 @@ func main() { go http.ListenAndServe("localhost:6061", nil) // pprof Server for Debbuging Mutexes node.Run( - node.Plugins( - banner.PLUGIN, - config.PLUGIN, - logger.PLUGIN, - cli.PLUGIN, - remotelog.PLUGIN, - portcheck.PLUGIN, - - autopeering.PLUGIN, - tangle.PLUGIN, - gossip.PLUGIN, - gracefulshutdown.PLUGIN, - - analysis.PLUGIN, - metrics.PLUGIN, - - webapi.PLUGIN, - webapi_auth.PLUGIN, - webapi_gtta.PLUGIN, - webapi_spammer.PLUGIN, - webapi_broadcastData.PLUGIN, - - spa.PLUGIN, - - /* - webapi_getTransactionTrytesByHash.PLUGIN, - webapi_getTransactionObjectsByHash.PLUGIN, - webapi_findTransactionHashes.PLUGIN, - webapi_getNeighbors.PLUGIN, - - //graph.PLUGIN, - */ - ), + core.PLUGINS, + research.PLUGINS, + ui.PLUGINS, + webapi.PLUGINS, ) } diff --git a/pluginmgr/core/plugins.go b/pluginmgr/core/plugins.go new file mode 100644 index 00000000..b4dfb2a0 --- /dev/null +++ b/pluginmgr/core/plugins.go @@ -0,0 +1,26 @@ +package core + +import ( + "github.com/iotaledger/goshimmer/plugins/autopeering" + "github.com/iotaledger/goshimmer/plugins/banner" + "github.com/iotaledger/goshimmer/plugins/cli" + "github.com/iotaledger/goshimmer/plugins/config" + "github.com/iotaledger/goshimmer/plugins/gossip" + "github.com/iotaledger/goshimmer/plugins/gracefulshutdown" + "github.com/iotaledger/goshimmer/plugins/logger" + "github.com/iotaledger/goshimmer/plugins/portcheck" + "github.com/iotaledger/goshimmer/plugins/tangle" + "github.com/iotaledger/hive.go/node" +) + +var PLUGINS = node.Plugins( + banner.PLUGIN, + config.PLUGIN, + logger.PLUGIN, + cli.PLUGIN, + portcheck.PLUGIN, + autopeering.PLUGIN, + tangle.PLUGIN, + gossip.PLUGIN, + gracefulshutdown.PLUGIN, +) diff --git a/pluginmgr/research/plugins.go b/pluginmgr/research/plugins.go new file mode 100644 index 00000000..5618c8d1 --- /dev/null +++ b/pluginmgr/research/plugins.go @@ -0,0 +1,14 @@ +package research + +import ( + "github.com/iotaledger/goshimmer/plugins/analysis" + "github.com/iotaledger/goshimmer/plugins/metrics" + "github.com/iotaledger/goshimmer/plugins/remotelog" + "github.com/iotaledger/hive.go/node" +) + +var PLUGINS = node.Plugins( + remotelog.PLUGIN, + analysis.PLUGIN, + metrics.PLUGIN, +) diff --git a/pluginmgr/ui/plugins.go b/pluginmgr/ui/plugins.go new file mode 100644 index 00000000..ddc66b11 --- /dev/null +++ b/pluginmgr/ui/plugins.go @@ -0,0 +1,12 @@ +package ui + +import ( + "github.com/iotaledger/goshimmer/plugins/graph" + "github.com/iotaledger/goshimmer/plugins/spa" + "github.com/iotaledger/hive.go/node" +) + +var PLUGINS = node.Plugins( + spa.PLUGIN, + graph.PLUGIN, +) diff --git a/pluginmgr/webapi/plugins.go b/pluginmgr/webapi/plugins.go new file mode 100644 index 00000000..7835b23b --- /dev/null +++ b/pluginmgr/webapi/plugins.go @@ -0,0 +1,26 @@ +package webapi + +import ( + "github.com/iotaledger/goshimmer/plugins/webapi" + webapi_broadcastData "github.com/iotaledger/goshimmer/plugins/webapi/broadcastData" + webapi_findTransactionHashes "github.com/iotaledger/goshimmer/plugins/webapi/findTransactionHashes" + webapi_getNeighbors "github.com/iotaledger/goshimmer/plugins/webapi/getNeighbors" + webapi_getTransactionObjectsByHash "github.com/iotaledger/goshimmer/plugins/webapi/getTransactionObjectsByHash" + webapi_getTransactionTrytesByHash "github.com/iotaledger/goshimmer/plugins/webapi/getTransactionTrytesByHash" + webapi_gtta "github.com/iotaledger/goshimmer/plugins/webapi/gtta" + webapi_spammer "github.com/iotaledger/goshimmer/plugins/webapi/spammer" + webapi_auth "github.com/iotaledger/goshimmer/plugins/webauth" + "github.com/iotaledger/hive.go/node" +) + +var PLUGINS = node.Plugins( + webapi.PLUGIN, + webapi_auth.PLUGIN, + webapi_gtta.PLUGIN, + webapi_spammer.PLUGIN, + webapi_broadcastData.PLUGIN, + webapi_getTransactionTrytesByHash.PLUGIN, + webapi_getTransactionObjectsByHash.PLUGIN, + webapi_findTransactionHashes.PLUGIN, + webapi_getNeighbors.PLUGIN, +) -- GitLab