Documentation ¶
Overview ¶
Package service provides simple service framework on top of Module interface. Ready made modules can be found under: github.com/elisasre/go-common/service/module.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPanic = errors.New("panic captured")
Functions ¶
func Run ¶
Run runs svc using following control flow:
- Exec Init() for each module in order. If error is occurred Run returns immediately.
- Exec Run() for each module in own goroutine.
- Wait for any Run() function to return. When that happens move to Stop sequence.
- Exec Stop() for modules in reverse order.
- Wait for all Run() and Stop() calls to return.
- Return all errors or nil
Possible panics inside modules are captured to allow graceful shutdown of other modules. Captured panics are converted into errors and ErrPanic is returned.
func RunAndExit ¶
func RunAndExit(svc Service)
Types ¶
Directories ¶
Path | Synopsis |
---|---|
module
|
|
httpserver
Package httpserver provides http server as module.
|
Package httpserver provides http server as module. |
httpserver/pprof
Package pprof provides pprof handler options for httpserver module.
|
Package pprof provides pprof handler options for httpserver module. |
httpserver/prom
Package prom provides prometheus metrics handler options for httpserver module.
|
Package prom provides prometheus metrics handler options for httpserver module. |
siglistener
Package siglistener provides signal listening as a module.
|
Package siglistener provides signal listening as a module. |
ticker
Package ticker provides ticker functionality as a module.
|
Package ticker provides ticker functionality as a module. |
Click to show internal directories.
Click to hide internal directories.