mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 06:42:16 +00:00
Add some docs
This commit is contained in:
parent
78d4c3b88a
commit
f81c319ece
@ -14,6 +14,12 @@ import (
|
|||||||
|
|
||||||
type handleFunc = func(event Event) (Events, error)
|
type handleFunc = func(event Event) (Events, error)
|
||||||
|
|
||||||
|
// Routines are a structure which model a finite state machine as serialized
|
||||||
|
// stream of events processed by a handle function. This Routine structure
|
||||||
|
// handles the concurrency and messaging guarantees. Events are sent via
|
||||||
|
// `trySend` are handled by the `handle` function to produce an iterator
|
||||||
|
// `next()`. Calling `close()` on a routine will conclude processing of all
|
||||||
|
// sent events and produce `last()` event representing the terminal state.
|
||||||
type Routine struct {
|
type Routine struct {
|
||||||
name string
|
name string
|
||||||
input chan Event
|
input chan Event
|
||||||
@ -56,7 +62,6 @@ func (rt *Routine) setMetrics(metrics *Metrics) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (rt *Routine) start() {
|
func (rt *Routine) start() {
|
||||||
// what if we call baseService.start
|
|
||||||
rt.logger.Info(fmt.Sprintf("%s: run\n", rt.name))
|
rt.logger.Info(fmt.Sprintf("%s: run\n", rt.name))
|
||||||
starting := atomic.CompareAndSwapUint32(rt.running, uint32(0), uint32(1))
|
starting := atomic.CompareAndSwapUint32(rt.running, uint32(0), uint32(1))
|
||||||
if !starting {
|
if !starting {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user