Documentation ¶
Index ¶
- type PetsCommand
- type PetsProc
- type ProcFS
- func (f ProcFS) AddProc(proc PetsProc) error
- func (f ProcFS) KillAllForTesting() error
- func (f ProcFS) ModifyProc(proc PetsProc) error
- func (f ProcFS) OpenFreshLogFile(key service.Key) (*os.File, error)
- func (f ProcFS) ProcsFromFS() ([]PetsProc, error)
- func (f ProcFS) ReadLogFile(key service.Key) (string, error)
- func (f ProcFS) RemoveAllProcs() error
- func (f ProcFS) RemoveDeadProcs() error
- func (f ProcFS) RemoveProc(proc PetsProc) error
- type Runner
- func (r Runner) Run(args []string, cwd string) error
- func (r Runner) RunWithIO(args []string, cwd string, stdout, stderr io.Writer) error
- func (r Runner) StartWithIO(args []string, cwd string, stdout, stderr io.Writer) (PetsCommand, error)
- func (r Runner) StartWithStdLogs(args []string, cwd string, key service.Key) (PetsCommand, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PetsCommand ¶
type PetsProc ¶
type PetsProc struct { // A name to show to humans DisplayName string `json:",omitempty"` // The process ID of a running process. Pid int `json:",omitempty"` // When the process started StartTime time.Time // The hostname that the process is listening on (e.g., 'localhost') Hostname string `json:",omitempty"` // The port that the process is listening on (e.g., '8080') Port int `json:",omitempty"` // The name+tier of the service that this process exposes ServiceName service.Name `json:",omitempty"` ServiceTier service.Tier `json:",omitempty"` }
Process state that we expect to be written to disk and queried.
func (PetsProc) ServiceKey ¶
func (PetsProc) WithExposedHost ¶
Creates a new PetsProc that we know is listening on the given host and port.
Calling this method automatically creates a copy because it's a struct method rather than a pointer method.
type ProcFS ¶
type ProcFS struct {
// contains filtered or unexported fields
}
Saves state about the currently running processes to the filesystem.
func NewProcFSWithDir ¶
func NewProcFSWithDir(wmDir *dirs.WindmillDir) (ProcFS, error)
func (ProcFS) KillAllForTesting ¶
Kill all the procs in the JSON file with a sigkill This is really only suitable for testing. 'pets down' uses a more graceful sigint with output.
func (ProcFS) ModifyProc ¶
Replace a proc in the JSON file matching the given proc's PID
func (ProcFS) OpenFreshLogFile ¶
Open a log file for writing. Truncate any existing contents of the file.
func (ProcFS) ProcsFromFS ¶
Read all the procs from the JSON file
func (ProcFS) ReadLogFile ¶
Returns the empty string if the log file doesn't exist.
func (ProcFS) RemoveAllProcs ¶
Remove all procs from the JSON file
func (ProcFS) RemoveDeadProcs ¶
Remove all dead proc from the JSON file
func (ProcFS) RemoveProc ¶
Remove a proc from the JSON file. If the process has already died, that's ok, it's not an error.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func (Runner) Run ¶
Run a command, waiting until it exits.
args: The command to run. cwd: The current working directory.
func (Runner) RunWithIO ¶
Run a command, waiting until it exits, forwarding all stdout/stderr to the given streams.
func (Runner) StartWithIO ¶
func (r Runner) StartWithIO(args []string, cwd string, stdout, stderr io.Writer) (PetsCommand, error)
Starts a command, waiting until it exits, forwarding all stdout/stderr to the given streams.