Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseOnSignal ¶
func CloseOnSignal(s Service)
CloseOnSignal calls the closeFunc on the os signals SIGINT and SIGTERM
Types ¶
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor handles gracefully closing execution for services Closing an executor goes through the states running, stopping, stopped and closed.
func (*Executor) IsRunning ¶
IsRunning should be used to determine if the execution should be halted. Will be false until Close() is called
func (*Executor) MarkAsClosed ¶
func (e *Executor) MarkAsClosed()
MarkAsClosed is to be called when the service using the executor is closed. The process can be stopped or killed now
func (*Executor) MarkAsStopped ¶
func (e *Executor) MarkAsStopped()
MarkAsStopped is to be called when the execution was stopped. All used resources can be cracefully closed and dispossed of now
func (*Executor) Stop ¶
func (e *Executor) Stop()
Stop is to be called when the executor should stop This is only safe to call once
func (*Executor) WaitUntilClosed ¶
func (e *Executor) WaitUntilClosed()
WaitUntilClosed waits until the Close func call of the executor is finished
func (*Executor) WaitUntilStopped ¶
WaitUntilStopped blocks until either MarkAsStopped() was called in any goroutine or the timeout has passed