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