mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-29 00:32:14 +00:00
add some notes + intentions
This commit is contained in:
parent
2545b73804
commit
ecde4df0f4
@ -5,6 +5,31 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func schedulerHandle(event Event) Events {
|
||||
switch event.(type) {
|
||||
case timeCheck:
|
||||
fmt.Println("scheduler handle timeCheck")
|
||||
case testEvent:
|
||||
fmt.Println("scheduler handle testEvent")
|
||||
return Events{scTestEvent{}}
|
||||
}
|
||||
return Events{}
|
||||
}
|
||||
|
||||
func processorHandle(event Event) Events {
|
||||
switch event.(type) {
|
||||
case timeCheck:
|
||||
fmt.Println("processor handle timeCheck")
|
||||
case testEvent:
|
||||
fmt.Println("processor handle testEvent")
|
||||
case scTestEvent:
|
||||
fmt.Println("processor handle scTestEvent")
|
||||
// should i stop myself?
|
||||
return Events{pcFinished{}}
|
||||
}
|
||||
return Events{}
|
||||
}
|
||||
|
||||
// reactor
|
||||
type Reactor struct {
|
||||
events chan Event
|
||||
|
@ -34,6 +34,8 @@ func newRoutine(name string, output chan Event, handleFunc handleFunc) *Routine
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: refactor the handle to return an second variable, error which can signal
|
||||
//to the run looop when the handler is done
|
||||
func (rt *Routine) run() {
|
||||
fmt.Printf("%s: run\n", rt.name)
|
||||
for {
|
||||
@ -45,6 +47,7 @@ func (rt *Routine) run() {
|
||||
return
|
||||
}
|
||||
oEvents := rt.handle(iEvent)
|
||||
// XXX: this should check for error and exit if error
|
||||
fmt.Printf("%s handled %d events\n", rt.name, len(oEvents))
|
||||
for _, event := range oEvents {
|
||||
// check for finished
|
||||
@ -108,28 +111,3 @@ func (rt *Routine) stop() {
|
||||
func (rt *Routine) wait() {
|
||||
<-rt.finished
|
||||
}
|
||||
|
||||
func schedulerHandle(event Event) Events {
|
||||
switch event.(type) {
|
||||
case timeCheck:
|
||||
fmt.Println("scheduler handle timeCheck")
|
||||
case testEvent:
|
||||
fmt.Println("scheduler handle testEvent")
|
||||
return Events{scTestEvent{}}
|
||||
}
|
||||
return Events{}
|
||||
}
|
||||
|
||||
func processorHandle(event Event) Events {
|
||||
switch event.(type) {
|
||||
case timeCheck:
|
||||
fmt.Println("processor handle timeCheck")
|
||||
case testEvent:
|
||||
fmt.Println("processor handle testEvent")
|
||||
case scTestEvent:
|
||||
fmt.Println("processor handle scTestEvent")
|
||||
// should i stop myself?
|
||||
return Events{pcFinished{}}
|
||||
}
|
||||
return Events{}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user