Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrMaxRestartsExhausted = errors.New("supervise: max restarts exhausted")
ErrMaxRestartsExhausted is returned when Run gives up.
Functions ¶
func BuildAgentForTest ¶
BuildAgentForTest compiles the cliwrap-agent binary once per test process and returns its path.
Types ¶
type AgentHandle ¶
type AgentHandle struct {
Socket *net.UnixConn
Process *os.Process
PID int
// contains filtered or unexported fields
}
AgentHandle is the result of spawning an agent: one half of a connected socket pair plus the OS process handle.
func (*AgentHandle) Close ¶
func (h *AgentHandle) Close() error
Close shuts the host side of the socket, sends SIGTERM to the agent, waits briefly, then SIGKILL if still alive. It is idempotent.
type BackoffStrategy ¶
BackoffStrategy computes the delay before the Nth restart attempt.
type ExponentialBackoff ¶
type ExponentialBackoff struct {
Initial time.Duration
Max time.Duration
Multiplier float64
Jitter float64 // 0..1, relative jitter range
// contains filtered or unexported fields
}
ExponentialBackoff is an exponential backoff with optional jitter.
type RestartLoop ¶
type RestartLoop struct {
// contains filtered or unexported fields
}
RestartLoop runs Starter.Start in a loop, honoring the configured policy.
func NewRestartLoop ¶
func NewRestartLoop(opts RestartLoopOptions) *RestartLoop
NewRestartLoop returns a loop.
type RestartLoopOptions ¶
type RestartLoopOptions struct {
Starter Starter
Policy RestartLoopPolicy
MaxRestarts int // 0 = unlimited
Backoff BackoffStrategy
}
RestartLoopOptions configures a RestartLoop.
type RestartLoopPolicy ¶
type RestartLoopPolicy int
RestartLoopPolicy controls whether Run retries on failure.
const ( RestartLoopNever RestartLoopPolicy = iota RestartLoopOnFailure RestartLoopAlways )
type Spawner ¶
type Spawner struct {
// contains filtered or unexported fields
}
Spawner starts agent subprocesses.
type SpawnerOptions ¶
type SpawnerOptions struct {
// AgentPath is the path to the cliwrap-agent binary. Required.
AgentPath string
// RuntimeDir is the parent directory for per-agent state.
RuntimeDir string
// ExtraEnv entries are appended to the agent's environment.
ExtraEnv []string
}
SpawnerOptions configures a Spawner.
type WatchResult ¶
WatchResult is the OS-level summary of a child's exit.