Browse Source

Add some docs

pull/3907/head
Sean Braithwaite 5 years ago
parent
commit
f81c319ece
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      blockchain/v2/routine.go

+ 6
- 1
blockchain/v2/routine.go View File

@ -14,6 +14,12 @@ import (
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 {
name string
input chan Event
@ -56,7 +62,6 @@ func (rt *Routine) setMetrics(metrics *Metrics) {
}
func (rt *Routine) start() {
// what if we call baseService.start
rt.logger.Info(fmt.Sprintf("%s: run\n", rt.name))
starting := atomic.CompareAndSwapUint32(rt.running, uint32(0), uint32(1))
if !starting {


Loading…
Cancel
Save