Documentation
¶
Index ¶
- Variables
- func SetupTreeCleanup() error
- type Process
- type ProcessCommand
- func (p *ProcessCommand) ID() string
- func (p *ProcessCommand) Logger() *logmon.Monitor
- func (p *ProcessCommand) Run(timeout time.Duration) error
- func (p *ProcessCommand) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (p *ProcessCommand) State() ProcessState
- func (p *ProcessCommand) Stop(timeout time.Duration) error
- func (p *ProcessCommand) WaitReady(ctx context.Context) error
- type ProcessState
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrStartAborted = fmt.Errorf("aborted")
Functions ¶
func SetupTreeCleanup ¶
func SetupTreeCleanup() error
SetupTreeCleanup is a no-op on non-Windows platforms, where upstream process teardown is handled via process-group signalling (see runtime_unix.go).
Types ¶
type Process ¶
type Process interface {
// Run starts the process blocks until the process is terminated.
// The timeout parameter controls how long to wait for the process to get
// to a ready state to process traffic
Run(timeout time.Duration) error
// WaitReady blocks until the process is ready to serve requests
// or the context is cancelled. It returns nil when the process is ready
WaitReady(context.Context) error
// Stop blocks until the process has terminated. It returns nil when
// the process terminated as expected (exit 0)
Stop(timeout time.Duration) error
// State returns the current state of the process
// Note: this is a snapshot of the state at the time of the call
// and may change at any time after the call returns.
State() ProcessState
// ServeHTTP forwards requests to the underlying process
// Calling it when the process is not ready will result in a
// 503 response with a body indicating it is a llama-swap-error
ServeHTTP(http.ResponseWriter, *http.Request)
// Logger returns the monitor that captures this process's stdout/stderr.
Logger() *logmon.Monitor
}
type ProcessCommand ¶
type ProcessCommand struct {
// contains filtered or unexported fields
}
func (*ProcessCommand) ID ¶
func (p *ProcessCommand) ID() string
func (*ProcessCommand) Logger ¶
func (p *ProcessCommand) Logger() *logmon.Monitor
func (*ProcessCommand) ServeHTTP ¶
func (p *ProcessCommand) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*ProcessCommand) State ¶
func (p *ProcessCommand) State() ProcessState
type ProcessState ¶
type ProcessState string
const ( StateStopped ProcessState = ProcessState("stopped") StateStarting ProcessState = ProcessState("starting") StateReady ProcessState = ProcessState("ready") StateStopping ProcessState = ProcessState("stopping") // process is shutdown and will not be restarted StateShutdown ProcessState = ProcessState("shutdown") )
Click to show internal directories.
Click to hide internal directories.