Documentation
¶
Index ¶
Constants ¶
View Source
const ( StartTestWorkerMsg = "Test worker started" StopTestWorkerMsg = "Test worker stopped" )
View Source
const ( TestProcessLogPath = "test_process.log" TestProcessPidFile = "test_process.pid" )
View Source
const (
EnvName = "TT_CLI_DAEMON"
)
Variables ¶
This section is empty.
Functions ¶
func IsDaemonAlive ¶
IsDaemonAlive checks is daemon alive by process pid.
func RunHTTPServerOnBackground ¶
RunHTTPServerOnBackground starts http daemon process.
func StopDaemon ¶
StopDaemon starts http daemon process.
Types ¶
type DaemonCtx ¶
type DaemonCtx struct {
// Port is a port number to be used for daemon http server.
Port int
// PIDFile is a path of a file contains pid of daemon process.
PIDFile string
// LogPath is a path to a file contains log of daemon process.
LogPath string
// LogMaxSize is the maximum size in megabytes of the log file
// before it gets rotated. It defaults to 100 megabytes.
LogMaxSize int
// LogMaxBackups is the maximum number of old log files to retain.
// The default is to retain all old log files (though LogMaxAge may
// still cause them to get deleted).
LogMaxBackups int
// LogMaxAge is the maximum number of days to retain old log files
// based on the timestamp encoded in their filename. Note that a
// day is defined as 24 hours and may not exactly correspond to
// calendar days due to daylight savings, leap seconds, etc. The
// default is not to remove old log files based on age.
LogMaxAge int
// ListenInterface is a network interface the IP address
// should be found on to bind http server socket.
ListenInterface string
}
DaemonCtx contains information for running an daemon instance.
func NewDaemonCtx ¶
func NewDaemonCtx(opts *config.DaemonOpts) *DaemonCtx
NewDaemonCtx creates the DaemonCtx context.
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
HTTPServer contains information for http server.
func NewHTTPServer ¶
func NewHTTPServer(listenInterface string, port int) *HTTPServer
NewHTTPServer creates new HTTPServer.
func (*HTTPServer) SetLogger ¶
func (httpServer *HTTPServer) SetLogger(logger *ttlog.Logger)
SetLogger sets a log file the HTTP server will write to.
func (*HTTPServer) Start ¶
func (httpServer *HTTPServer) Start(ttPath string)
Start starts HTTP server.
func (*HTTPServer) Timeout ¶
func (httpServer *HTTPServer) Timeout(timeout time.Duration) *HTTPServer
Timeout sets the time that was provided to the HTTP server to shutdown correctly.
type Process ¶
type Process struct {
// DaemonTag is an env name to check the process is a child process.
DaemonTag string
// contains filtered or unexported fields
}
Process describes a running process.
func NewProcess ¶
func NewProcess(worker Worker, pidFileName string, logOpts ttlog.LoggerOpts) *Process
NewProcess creates new Process.
Click to show internal directories.
Click to hide internal directories.