Documentation ¶
Index ¶
- func DeleteAllStatusesForService(service *services.ServiceConfig, baseDir string) error
- func DeleteStatusForService(service *services.ServiceConfig, instanceId, baseDir string) error
- func HasRunning(dirConfig *home.EdwardConfiguration, service *services.ServiceConfig) (bool, error)
- func Launch(dirConfig *home.EdwardConfiguration, c *services.ServiceConfig, ...) error
- func LoadRunningServices(stateDir string) ([]services.ServiceOrGroup, error)
- func LoadStatusForService(service *services.ServiceConfig, baseDir string) (map[string]Status, error)
- func SaveStatusForService(service *services.ServiceConfig, instanceId string, status Status, ...) error
- func Stop(dirConfig *home.EdwardConfiguration, c *services.ServiceConfig, ...) error
- func WaitUntilRunning(dirCfg *home.EdwardConfiguration, cmd *exec.Cmd, ...) error
- type Instance
- type Processes
- type State
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteAllStatusesForService ¶
func DeleteAllStatusesForService(service *services.ServiceConfig, baseDir string) error
func DeleteStatusForService ¶
func DeleteStatusForService(service *services.ServiceConfig, instanceId, baseDir string) error
func HasRunning ¶
func HasRunning(dirConfig *home.EdwardConfiguration, service *services.ServiceConfig) (bool, error)
HasRunning returns true iff the specified service has a currently running instance
func Launch ¶
func Launch(dirConfig *home.EdwardConfiguration, c *services.ServiceConfig, cfg services.OperationConfig, overrides services.ContextOverride, task tracker.Task, pool *worker.Pool) error
Launch launches this service
func LoadRunningServices ¶
func LoadRunningServices(stateDir string) ([]services.ServiceOrGroup, error)
func LoadStatusForService ¶
func SaveStatusForService ¶
func Stop ¶
func Stop(dirConfig *home.EdwardConfiguration, c *services.ServiceConfig, cfg services.OperationConfig, overrides services.ContextOverride, task tracker.Task, pool *worker.Pool) error
Stop stops this service
func WaitUntilRunning ¶
func WaitUntilRunning(dirCfg *home.EdwardConfiguration, cmd *exec.Cmd, service *services.ServiceConfig) error
WaitUntilRunning will block the specified service until it enters the running state
Types ¶
type Instance ¶
type Instance struct { // Parent service config Service *services.ServiceConfig `json:"service"` // Pid of currently running instance Pid int `json:"pid"` // Config file from which this instance was launched ConfigFile string `json:"configFile"` // The edward version under which this instance was launched EdwardVersion string `json:"edwardVersion"` // Overrides applied by the group under which this service was started Overrides services.ContextOverride `json:"overrides,omitempty"` // Identifier for this instance of the service InstanceId string // contains filtered or unexported fields }
Instance provides state and functions for managing a service
func Load ¶
func Load( dirConfig *home.EdwardConfiguration, processes Processes, service *services.ServiceConfig, overrides services.ContextOverride, ) (command *Instance, err error)
Load loads an instance to control the specified service
func (*Instance) Getenv ¶
Getenv returns the environment variable value for the provided key, if present. Env overrides are consulted first, followed by service env settings, then the os Env.
func (*Instance) StartAsync ¶
StartAsync starts the service in the background Will block until the service is known to have started successfully. If the service fails to launch, an error will be returned.
func (*Instance) StopSync ¶
func (c *Instance) StopSync(cfg services.OperationConfig, overrides services.ContextOverride, task tracker.Task) error
StopSync stops this service in a synchronous manner
type Processes ¶ added in v1.8.12
type Processes interface { // PidExists returns true iff the process with the provided PID exists. PidExists(pid int) (bool, error) // PidCommandMatches returns true iff the process with the provided PID exists, // and its command contains the provided string. PidCommandMatches(pid int, value string) (bool, error) // SendSignal issues the specified signal to the process running with the provided PID. // If the PID does not exist, no error will be returned. SendSignal(pid int, signal syscall.Signal) error // KillGroup sends a kill signal to the group containing the provided PID. // If sudo is true, the group will be killed with superuser priviledges, // it will be assumed that these priviledges have been given to this process on launch. KillGroup(pid int, sudo bool) error }
Processes provides functions for working with processes