tart

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

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

View Source
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 Cmd

type Cmd = vmexec.Cmd

Cmd is one tart invocation.

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 New

func New(c Config) *Driver

New returns a driver.

func (*Driver) Create

func (d *Driver) Create(ctx context.Context, name string, spec workspace.Spec) error

Create implements workspace.Driver: tart clone <warm base> <name>, then tart set.

func (*Driver) Destroy

func (d *Driver) Destroy(ctx context.Context, name string) error

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

func (d *Driver) Get(ctx context.Context, name, srcDir, dstDir string, files ...string) error

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

func (d *Driver) List(ctx context.Context) ([]string, error)

List implements workspace.Driver: tart list's local VMs with a workspace name.

func (*Driver) Put

func (d *Driver) Put(ctx context.Context, name, srcDir, dstDir string) error

Put implements workspace.Driver: a tar stream of srcDir (directories and regular files only) into tart exec -i … sudo sh -c putScript.

func (*Driver) Start

func (d *Driver) Start(ctx context.Context, name string) (workspace.Network, error)

Start implements workspace.Driver: tart run in the background on Softnet, with Softnet's directory first on PATH; then it polls tart exec true and reads the VM's routes.

func (*Driver) Stop

func (d *Driver) Stop(ctx context.Context, name string) error

Stop implements workspace.Driver: tart stop, then its tart run is reaped. It runs after ctx is done too.

type ExecRunner

type ExecRunner = vmexec.ExecRunner

ExecRunner runs real programs.

type Runner

type Runner = vmexec.Runner

Runner runs tart. Tests use a fake; nothing in them runs the real tart.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL