StartStopFunc produces a `startstop.Service` from a function. It's useful for very small services that don't necessarily need a whole struct defined for them.
(startFunc func(ctx context.Context, shouldStart bool, started, stopped func()) error)
| 268 | // very small services that don't necessarily need a whole struct defined for |
| 269 | // them. |
| 270 | func StartStopFunc(startFunc func(ctx context.Context, shouldStart bool, started, stopped func()) error) *startStopFunc { |
| 271 | return &startStopFunc{ |
| 272 | startFunc: startFunc, |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | func (s *startStopFunc) Start(ctx context.Context) error { |
| 277 | return s.startFunc(s.StartInit(ctx)) |
no outgoing calls
searching dependent graphs…