mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-29 16:52:15 +00:00
add some notes + intentions
This commit is contained in:
parent
2545b73804
commit
ecde4df0f4
@ -5,6 +5,31 @@ import (
|
|||||||
"time"
|
"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
|
// reactor
|
||||||
type Reactor struct {
|
type Reactor struct {
|
||||||
events chan Event
|
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() {
|
func (rt *Routine) run() {
|
||||||
fmt.Printf("%s: run\n", rt.name)
|
fmt.Printf("%s: run\n", rt.name)
|
||||||
for {
|
for {
|
||||||
@ -45,6 +47,7 @@ func (rt *Routine) run() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
oEvents := rt.handle(iEvent)
|
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))
|
fmt.Printf("%s handled %d events\n", rt.name, len(oEvents))
|
||||||
for _, event := range oEvents {
|
for _, event := range oEvents {
|
||||||
// check for finished
|
// check for finished
|
||||||
@ -108,28 +111,3 @@ func (rt *Routine) stop() {
|
|||||||
func (rt *Routine) wait() {
|
func (rt *Routine) wait() {
|
||||||
<-rt.finished
|
<-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