Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Goshimmer_without_tipselection
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
COLLET Ismael
Goshimmer_without_tipselection
Commits
7e0c61dd
Commit
7e0c61dd
authored
5 years ago
by
Hans Moog
Browse files
Options
Downloads
Patches
Plain Diff
Feat: activated bundle processor
parent
5b512eea
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
main.go
+2
-0
2 additions, 0 deletions
main.go
plugins/bundleprocessor/plugin.go
+32
-4
32 additions, 4 deletions
plugins/bundleprocessor/plugin.go
with
34 additions
and
4 deletions
main.go
+
2
−
0
View file @
7e0c61dd
...
@@ -4,6 +4,7 @@ import (
...
@@ -4,6 +4,7 @@ import (
"github.com/iotaledger/goshimmer/packages/node"
"github.com/iotaledger/goshimmer/packages/node"
"github.com/iotaledger/goshimmer/plugins/analysis"
"github.com/iotaledger/goshimmer/plugins/analysis"
"github.com/iotaledger/goshimmer/plugins/autopeering"
"github.com/iotaledger/goshimmer/plugins/autopeering"
"github.com/iotaledger/goshimmer/plugins/bundleprocessor"
"github.com/iotaledger/goshimmer/plugins/cli"
"github.com/iotaledger/goshimmer/plugins/cli"
"github.com/iotaledger/goshimmer/plugins/gossip"
"github.com/iotaledger/goshimmer/plugins/gossip"
gossip_on_solidification
"github.com/iotaledger/goshimmer/plugins/gossip-on-solidification"
gossip_on_solidification
"github.com/iotaledger/goshimmer/plugins/gossip-on-solidification"
...
@@ -25,6 +26,7 @@ func main() {
...
@@ -25,6 +26,7 @@ func main() {
gossip
.
PLUGIN
,
gossip
.
PLUGIN
,
gossip_on_solidification
.
PLUGIN
,
gossip_on_solidification
.
PLUGIN
,
tangle
.
PLUGIN
,
tangle
.
PLUGIN
,
bundleprocessor
.
PLUGIN
,
analysis
.
PLUGIN
,
analysis
.
PLUGIN
,
gracefulshutdown
.
PLUGIN
,
gracefulshutdown
.
PLUGIN
,
tipselection
.
PLUGIN
,
tipselection
.
PLUGIN
,
...
...
This diff is collapsed.
Click to expand it.
plugins/bundleprocessor/plugin.go
+
32
−
4
View file @
7e0c61dd
package
bundleprocessor
package
bundleprocessor
import
(
import
(
"github.com/iotaledger/goshimmer/packages/daemon"
"github.com/iotaledger/goshimmer/packages/events"
"github.com/iotaledger/goshimmer/packages/events"
"github.com/iotaledger/goshimmer/packages/model/value_transaction"
"github.com/iotaledger/goshimmer/packages/model/value_transaction"
"github.com/iotaledger/goshimmer/packages/node"
"github.com/iotaledger/goshimmer/packages/node"
"github.com/iotaledger/goshimmer/packages/workerpool"
"github.com/iotaledger/goshimmer/plugins/tangle"
"github.com/iotaledger/goshimmer/plugins/tangle"
)
)
var
PLUGIN
=
node
.
NewPlugin
(
"Bundle Processor"
,
configure
)
var
PLUGIN
=
node
.
NewPlugin
(
"Bundle Processor"
,
configure
,
run
)
func
configure
(
plugin
*
node
.
Plugin
)
{
func
configure
(
plugin
*
node
.
Plugin
)
{
workerPool
=
workerpool
.
New
(
func
(
task
workerpool
.
Task
)
{
if
_
,
err
:=
ProcessSolidBundleHead
(
task
.
Param
(
0
)
.
(
*
value_transaction
.
ValueTransaction
));
err
!=
nil
{
plugin
.
LogFailure
(
err
.
Error
())
}
},
workerpool
.
WorkerCount
(
WORKER_COUNT
),
workerpool
.
QueueSize
(
2
*
WORKER_COUNT
))
tangle
.
Events
.
TransactionSolid
.
Attach
(
events
.
NewClosure
(
func
(
tx
*
value_transaction
.
ValueTransaction
)
{
tangle
.
Events
.
TransactionSolid
.
Attach
(
events
.
NewClosure
(
func
(
tx
*
value_transaction
.
ValueTransaction
)
{
if
tx
.
IsHead
()
{
if
tx
.
IsHead
()
{
if
_
,
err
:=
ProcessSolidBundleHead
(
tx
);
err
!=
nil
{
workerPool
.
Submit
(
tx
)
plugin
.
LogFailure
(
err
.
Error
())
}
}
}
}))
}))
daemon
.
Events
.
Shutdown
.
Attach
(
events
.
NewClosure
(
func
()
{
plugin
.
LogInfo
(
"Stopping Bundle Processor ..."
)
workerPool
.
Stop
()
}))
}
func
run
(
plugin
*
node
.
Plugin
)
{
plugin
.
LogInfo
(
"Starting Bundle Processor ..."
)
daemon
.
BackgroundWorker
(
func
()
{
plugin
.
LogSuccess
(
"Starting Bundle Processor ... done"
)
workerPool
.
Run
()
plugin
.
LogSuccess
(
"Stopping Bundle Processor ... done"
)
})
}
}
var
workerPool
*
workerpool
.
WorkerPool
const
WORKER_COUNT
=
10000
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment