Documentation ¶
Index ¶
- Constants
- func TryCatch(f Worker)
- type Worker
- type WorkerManager
- func (wm *WorkerManager) AddWorker(w Worker)
- func (wm *WorkerManager) AddWorkerList(w []Worker)
- func (wm *WorkerManager) MakeRecvSignal() os.Signal
- func (wm *WorkerManager) MakeSignal()
- func (wm *WorkerManager) RecvSignal() os.Signal
- func (wm *WorkerManager) Start()
- func (wm *WorkerManager) Stop()
- func (wm *WorkerManager) WaitTimeout(timeout int) int
Constants ¶
View Source
const ( // GracefulExitCode exit normally code GracefulExitCode = 0 // ForceTimeoutExitCode timeout exit code ForceTimeoutExitCode = 1 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Worker ¶
type Worker interface { Start() Stop() GetProcessName() string }
Worker working external interface
type WorkerManager ¶
type WorkerManager struct { sync.WaitGroup WorkerSlice []Worker Running bool Q chan os.Signal Ctx context.Context CtxCancel context.CancelFunc }
WorkerManager working concrete implementation class
func NewWorkerManager ¶
func NewWorkerManager() *WorkerManager
NewWorkerManager initialization WorkerManager class
func (*WorkerManager) AddWorker ¶
func (wm *WorkerManager) AddWorker(w Worker)
AddWorker add worker and start service
func (*WorkerManager) AddWorkerList ¶
func (wm *WorkerManager) AddWorkerList(w []Worker)
AddWorkerList add workers and start service
func (*WorkerManager) MakeRecvSignal ¶
func (wm *WorkerManager) MakeRecvSignal() os.Signal
MakeRecvSignal receive user signals
func (*WorkerManager) MakeSignal ¶
func (wm *WorkerManager) MakeSignal()
MakeSignal semaphores are currently supported
func (*WorkerManager) RecvSignal ¶
func (wm *WorkerManager) RecvSignal() os.Signal
RecvSignal receive signal
func (*WorkerManager) WaitTimeout ¶
func (wm *WorkerManager) WaitTimeout(timeout int) int
WaitTimeout close channel and exit
Click to show internal directories.
Click to hide internal directories.