NewIdleService initializes basic service as an "idle" service -- it doesn't do anything in its Running state, but still supports all state transitions.
(up StartingFn, down StoppingFn)
| 9 | // NewIdleService initializes basic service as an "idle" service -- it doesn't do anything in its Running state, |
| 10 | // but still supports all state transitions. |
| 11 | func NewIdleService(up StartingFn, down StoppingFn) *BasicService { |
| 12 | run := func(ctx context.Context) error { |
| 13 | <-ctx.Done() |
| 14 | return nil |
| 15 | } |
| 16 | |
| 17 | return NewBasicService(up, run, down) |
| 18 | } |
| 19 | |
| 20 | // OneIteration is one iteration of the timer service. Called repeatedly until service is stopped, or this function returns error |
| 21 | // in which case, service will fail. |