Documentation
¶
Index ¶
- Constants
- func CreateListener(addr string) (net.Listener, error)
- func CreateOrImportListener(addr string) (net.Listener, error)
- func DoReloadAppGraceful()
- func FireTrigger(name string, value interface{}) error
- func FireTriggerWithContext(name string, ctx context.Context, value interface{}) error
- func ForkChild(addr string, ln net.Listener) (*os.Process, error)
- func GetWaitingGroup() *sync.WaitGroup
- func ImportListener(addr string) (net.Listener, error)
- func IsCriticalError(err error) bool
- func IsFallingDown() bool
- func IsFileExistsAndIsDir(filename string) bool
- func IsFileExistsAndIsFile(filename string) bool
- func Message(cmd Command)
- func MessageWithArgs(cmd Command, args map[string]string)
- func NewCriticalError(message string) error
- func RegisterListener(name string, listener EventHandler)
- func Reload()
- func Run(pathForPids string, handlerAfterFinish func())
- func Stop()
- type ChannelMessage
- type Command
- type CriticalError
- type EventHandler
- type TcpKeepAliveListener
Constants ¶
const ( FINISH_APP_GRACEFULLY Command = iota RELOAD_APP UseSignalParam = "signal" UseSignalParamTrue = "1" UseSignalParamFalse = "" )
const ( // only we can read, modify and save PIDS_STORAGE_PATH_PERMS = 0700 // only we can read and modify PIDS_STORAGE_FILE_PERMS = 0600 EnvWorkerName = "DAEMON_WORKER" EnvWorkerNameValue = "1" )
Variables ¶
This section is empty.
Functions ¶
func DoReloadAppGraceful ¶
func DoReloadAppGraceful()
DoReloadAppGraceful block accepting new connections and wait until all current connections are completed, then reload the application Deprecated: use Reload instead
func FireTrigger ¶
func FireTriggerWithContext ¶
func ForkChild ¶
There is one problem with forking - when you do this, the program will detach from the console and the other process will, in fact, the program will run in the background and spit on the console, so in such a situation, when you use it, you should:
1. Fork the first program you run as well 2. Save logs in the logs folder
func GetWaitingGroup ¶
func IsCriticalError ¶
func IsFallingDown ¶
func IsFallingDown() bool
IsFallingDown is the application reloading? If so, you should not accept new connections to your server in this situation
func IsFileExistsAndIsDir ¶
func IsFileExistsAndIsFile ¶
func MessageWithArgs ¶
func NewCriticalError ¶
func RegisterListener ¶
func RegisterListener(name string, listener EventHandler)
RegisterListener Registering a listener ListenerHandler should not return an error, and if it does at all, we should not interrupt the application because of it! this should be done by the plugin itself if necessary
func Reload ¶
func Reload()
Reload Anyone can do this to make the server reload functions for end applications
Types ¶
type ChannelMessage ¶
type CriticalError ¶
type CriticalError struct {
Message string
}
func (CriticalError) Error ¶
func (t CriticalError) Error() string
type EventHandler ¶
type TcpKeepAliveListener ¶
type TcpKeepAliveListener struct {
*net.TCPListener
}
TcpKeepAliveListener sets TCP keep-alive timeouts on accepted connections. It's used by ListenAndServe and ListenAndServeTLS so dead TCP connections (e.g. closing laptop mid-download) eventually go away.
func NewListener ¶
func NewListener(address string) (*TcpKeepAliveListener, bool, error)