NewBasicService returns service built from three functions (using BasicService).
(start StartingFn, run RunningFn, stop StoppingFn)
| 82 | |
| 83 | // NewBasicService returns service built from three functions (using BasicService). |
| 84 | func NewBasicService(start StartingFn, run RunningFn, stop StoppingFn) *BasicService { |
| 85 | return &BasicService{ |
| 86 | startFn: start, |
| 87 | runningFn: run, |
| 88 | stoppingFn: stop, |
| 89 | state: New, |
| 90 | runningWaitersCh: make(chan struct{}), |
| 91 | terminatedWaitersCh: make(chan struct{}), |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | // WithName sets service name, if service is still in New state, and returns service to allow |
| 96 | // usage like NewBasicService(...).WithName("service name"). |
no outgoing calls