Documentation ¶
Index ¶
- Variables
- func Umask(mask int) (old int, err error)
- type Client
- type ClientState
- type Empty
- type ExitCode
- type Logs
- type RegisterResponse
- type RunState
- type Runner
- func (r *Runner) AnyClientIn(state ClientState) bool
- func (r *Runner) Done() <-chan struct{}
- func (r *Runner) Exit(args ExitCode, reply *Empty) error
- func (r *Runner) Interrupt() error
- func (r *Runner) Register(id int, reply *RegisterResponse) error
- func (r *Runner) Run(ctx context.Context) error
- func (r *Runner) Started() <-chan struct{}
- func (r *Runner) Status(id int, reply *RunState) error
- func (r *Runner) Terminate() error
- func (r *Runner) WaitStatus() process.WaitStatus
- func (r *Runner) WriteLogs(args Logs, reply *Empty) error
- type RunnerConfig
Constants ¶
This section is empty.
Variables ¶
var ErrInterrupt = errors.New("interrupt signal received")
Functions ¶
Types ¶
type ClientState ¶ added in v3.84.0
type ClientState int
const ( StateNotYetConnected ClientState = iota StateConnected StateExited StateLost )
type RegisterResponse ¶
type RegisterResponse struct {
Env []string
}
RegisterResponse is an RPC message to registering clients containing info needed to run.
type RunState ¶
type RunState int
RunState is an RPC message that describes to a client whether the job should continue waiting before running, start running, or stop running.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner implements the agent's jobRunner interface, but instead of directly managing a subprocess, it runs a socket server that is connected to from another container.
func NewRunner ¶ added in v3.84.0
func NewRunner(l logger.Logger, c RunnerConfig) *Runner
NewRunner returns a runner, implementing the agent's jobRunner interface.
func (*Runner) AnyClientIn ¶ added in v3.84.0
func (r *Runner) AnyClientIn(state ClientState) bool
AnyClientIn reports whether any of the clients are in a particular state.
func (*Runner) Done ¶
func (r *Runner) Done() <-chan struct{}
Done returns a channel that is closed when the job is completed.
func (*Runner) Register ¶
func (r *Runner) Register(id int, reply *RegisterResponse) error
Register is called when the client registers with the runner. The reply contains the env vars that would normally be in the environment of the bootstrap subcommand, particularly, the agent session token.
func (*Runner) Started ¶
func (r *Runner) Started() <-chan struct{}
Started returns a channel that is closed when the job has started running.
func (*Runner) Status ¶
Status is called by the client to check the status of the job, so that it can pack things up if the job is cancelled. If the client stops calling Status before calling Exit, we assume it is lost.
func (*Runner) WaitStatus ¶
func (r *Runner) WaitStatus() process.WaitStatus
WaitStatus returns a wait status that represents all the clients.