Documentation
¶
Overview ¶
Package tart is the workspace driver for macOS: it drives the tart CLI (P1 §1, design/workstreams/agent/LLD/supervise.md). Each workspace is a clone of the warm base, run on Softnet with every address blocked but the Mac's (--net-softnet-allow=@host), so its only route out is the gateway on its bridge address.
Index ¶
- Constants
- type Cmd
- type Config
- type Driver
- func (d *Driver) Create(ctx context.Context, name string, spec workspace.Spec) error
- func (d *Driver) Destroy(ctx context.Context, name string) error
- func (d *Driver) Exec(ctx context.Context, name string, argv []string, stdin io.Reader, ...) error
- func (d *Driver) Get(ctx context.Context, name, srcDir, dstDir string, files ...string) error
- func (d *Driver) List(ctx context.Context) ([]string, error)
- func (d *Driver) Put(ctx context.Context, name, srcDir, dstDir string) error
- func (d *Driver) Start(ctx context.Context, name string) (workspace.Network, error)
- func (d *Driver) Stop(ctx context.Context, name string) error
- type ExecRunner
- type Runner
Constants ¶
const MaxGet = vmexec.MaxGet
MaxGet bounds Get's compressed stream by default: vmexec's.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Bin is the tart to run: host.Env.TartBin, the one host check accepts. Default "tart".
Bin string
// WarmBase is the VM Create clones: default host.WarmBaseVM.
WarmBase string
// Path is the PATH tart run gets after Softnet's directory (host.SoftnetPath's), so Tart
// runs host init's Softnet; default the process's PATH.
Path string
Runner Runner
// Log gets tart run's output; default io.Discard.
Log io.Writer
// Boot bounds Start's wait for tart exec to answer (3 minutes), polled every Poll (1 s).
Boot, Poll time.Duration
// Grace is how long Exec waits after the remote SIGTERM before SIGKILL (45 s: factory-agent
// run's down gets at most 30 s after a SIGTERM).
Grace time.Duration
// MaxGet bounds Get's stream: default MaxGet.
MaxGet int64
}
Config is the driver's setup; every field but Bin has a default.
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver is the tart workspace driver. It's safe for concurrent use on different workspaces.
func (*Driver) Create ¶
Create implements workspace.Driver: tart clone <warm base> <name>, then tart set.
func (*Driver) Destroy ¶
Destroy implements workspace.Driver: tart stop when it's running, then tart delete. It runs after ctx is done too, and its tart run is reaped on every path: its SIGTERM ends the VM when tart stop never ran.
func (*Driver) Exec ¶
func (d *Driver) Exec(ctx context.Context, name string, argv []string, stdin io.Reader, stdout, stderr io.Writer) error
Exec implements workspace.Driver: tart exec [-i] <name> sh -c vmexec.ExecScript <pid file> argv…. When ctx is done it signals the remote process through another tart exec (TERM, then KILL after Grace) and stops the local tart exec once it hasn't exited.
func (*Driver) Get ¶
Get implements workspace.Driver: tart exec … sudo tar -czf - -C <srcDir> . (or the named files) into a temp file next to dstDir (at most MaxGet bytes), then host.Extract into dstDir. A failure removes dstDir.
func (*Driver) List ¶
List implements workspace.Driver: tart list's local VMs with a workspace name.
func (*Driver) Put ¶
Put implements workspace.Driver: a tar stream of srcDir (directories and regular files only) into tart exec -i … sudo sh -c putScript.