Documentation
¶
Index ¶
- func DefaultMounts(workspaceDirs []string) map[string]string
- func DeleteVMState() error
- func MountFlags(mounts map[string]string) []string
- func ResolveMountParent(path string) (string, error)
- func SaveVMState(s *VMState) error
- func TranslatePath(hostPath string, mounts map[string]string) (string, bool)
- func TranslateVolumeSpec(spec string, mounts map[string]string) (string, error)
- type Manager
- func (m *Manager) EnsureRunning(ctx context.Context) error
- func (m *Manager) ExpandMounts(ctx context.Context, paths []string) error
- func (m *Manager) Mounts() map[string]string
- func (m *Manager) Name() string
- func (m *Manager) Remove(ctx context.Context) error
- func (m *Manager) Status(ctx context.Context) string
- func (m *Manager) Stop(ctx context.Context) error
- func (m *Manager) VMIP(ctx context.Context) string
- type SharedVMRuntime
- func (s *SharedVMRuntime) BinaryPath() string
- func (s *SharedVMRuntime) ContainerExec(ctx context.Context, nameOrID string, args []string, interactive bool) error
- func (s *SharedVMRuntime) ContainerInspect(ctx context.Context, nameOrID string) ([]byte, error)
- func (s *SharedVMRuntime) ContainerList(ctx context.Context, all bool) ([]engine.ContainerInfo, error)
- func (s *SharedVMRuntime) ContainerLogs(ctx context.Context, nameOrID string, follow bool) error
- func (s *SharedVMRuntime) ContainerRemove(ctx context.Context, nameOrID string, force bool) error
- func (s *SharedVMRuntime) ContainerRun(ctx context.Context, args []string, interactive bool) error
- func (s *SharedVMRuntime) ContainerStart(ctx context.Context, nameOrID string) error
- func (s *SharedVMRuntime) ContainerStop(ctx context.Context, nameOrID string) error
- func (s *SharedVMRuntime) Exec(ctx context.Context, args ...string) ([]byte, []byte, error)
- func (s *SharedVMRuntime) ExecInteractive(ctx context.Context, args ...string) error
- func (s *SharedVMRuntime) ExecStream(ctx context.Context, args ...string) (io.ReadCloser, error)
- func (s *SharedVMRuntime) ImageBuild(ctx context.Context, args []string) error
- func (s *SharedVMRuntime) ImageList(ctx context.Context) ([]engine.ImageInfo, error)
- func (s *SharedVMRuntime) ImagePull(ctx context.Context, image string, opts engine.ImagePullOpts) error
- func (s *SharedVMRuntime) ImagePush(ctx context.Context, image string) error
- func (s *SharedVMRuntime) ImageRemove(ctx context.Context, image string) error
- func (s *SharedVMRuntime) NetworkConnect(ctx context.Context, network, container string) error
- func (s *SharedVMRuntime) NetworkCreate(ctx context.Context, name string) error
- func (s *SharedVMRuntime) NetworkDisconnect(ctx context.Context, network, container string) error
- func (s *SharedVMRuntime) NetworkInspect(ctx context.Context, name string) ([]byte, error)
- func (s *SharedVMRuntime) NetworkList(ctx context.Context) ([]engine.NetworkInfo, error)
- func (s *SharedVMRuntime) NetworkRemove(ctx context.Context, name string) error
- func (s *SharedVMRuntime) Validate() error
- func (s *SharedVMRuntime) VolumeCreate(ctx context.Context, name string) error
- func (s *SharedVMRuntime) VolumeInspect(ctx context.Context, name string) ([]byte, error)
- func (s *SharedVMRuntime) VolumeList(ctx context.Context) ([]engine.VolumeInfo, error)
- func (s *SharedVMRuntime) VolumeRemove(ctx context.Context, name string) error
- type VMState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultMounts ¶
DefaultMounts returns mount mappings from workspace dirs. Each host dir is mounted at /host<dir> inside the VM. e.g., /Users/adrian → /host/Users/adrian
func DeleteVMState ¶
func DeleteVMState() error
func MountFlags ¶
MountFlags returns -v flags for VM creation from the mount mapping.
func ResolveMountParent ¶ added in v0.6.0
ResolveMountParent determines which directory to mount for a given path. If the path is a directory, it returns that directory. If the path is a file (or doesn't exist), it walks up to find the nearest existing parent directory. Symlinks in the input are resolved before the blocklist check, so a symlink pointing at a blocked system root is rejected. Returns an error if the resolved directory is a blocked broad system root or if the path is not absolute.
func SaveVMState ¶
func TranslatePath ¶
TranslatePath converts a host-absolute path to its VM-internal path. Returns (translated, true) if a mount covers the path, or (original, false) if not.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles the lifecycle of the persistent shared VM.
func NewManagerWithName ¶ added in v0.6.0
NewManagerWithName creates a manager for a VM with a custom name. Used for per-project compose VMs in full isolation mode.
func (*Manager) EnsureRunning ¶
EnsureRunning ensures the shared VM is running, creating it if needed.
func (*Manager) ExpandMounts ¶ added in v0.6.0
ExpandMounts adds new host paths to the VM's mount set. Since Apple Container only accepts -v at creation time, this requires stopping and recreating the VM. Returns an error if containers are running inside the VM.
type SharedVMRuntime ¶
type SharedVMRuntime struct {
// contains filtered or unexported fields
}
SharedVMRuntime implements engine.Runtime by proxying all operations into a persistent shared VM. Each method constructs a gocker CLI command and executes it via `container exec gocker-shared gocker <args>`.
func NewSharedVMRuntime ¶
func NewSharedVMRuntime(manager *Manager, apple engine.Runtime) *SharedVMRuntime
func (*SharedVMRuntime) BinaryPath ¶
func (s *SharedVMRuntime) BinaryPath() string
func (*SharedVMRuntime) ContainerExec ¶
func (*SharedVMRuntime) ContainerInspect ¶
func (*SharedVMRuntime) ContainerList ¶
func (s *SharedVMRuntime) ContainerList(ctx context.Context, all bool) ([]engine.ContainerInfo, error)
func (*SharedVMRuntime) ContainerLogs ¶
func (*SharedVMRuntime) ContainerRemove ¶
func (*SharedVMRuntime) ContainerRun ¶
func (*SharedVMRuntime) ContainerStart ¶
func (s *SharedVMRuntime) ContainerStart(ctx context.Context, nameOrID string) error
func (*SharedVMRuntime) ContainerStop ¶
func (s *SharedVMRuntime) ContainerStop(ctx context.Context, nameOrID string) error
func (*SharedVMRuntime) ExecInteractive ¶
func (s *SharedVMRuntime) ExecInteractive(ctx context.Context, args ...string) error
func (*SharedVMRuntime) ExecStream ¶
func (s *SharedVMRuntime) ExecStream(ctx context.Context, args ...string) (io.ReadCloser, error)
func (*SharedVMRuntime) ImageBuild ¶
func (s *SharedVMRuntime) ImageBuild(ctx context.Context, args []string) error
func (*SharedVMRuntime) ImagePull ¶
func (s *SharedVMRuntime) ImagePull(ctx context.Context, image string, opts engine.ImagePullOpts) error
func (*SharedVMRuntime) ImagePush ¶
func (s *SharedVMRuntime) ImagePush(ctx context.Context, image string) error
func (*SharedVMRuntime) ImageRemove ¶
func (s *SharedVMRuntime) ImageRemove(ctx context.Context, image string) error
func (*SharedVMRuntime) NetworkConnect ¶
func (s *SharedVMRuntime) NetworkConnect(ctx context.Context, network, container string) error
func (*SharedVMRuntime) NetworkCreate ¶
func (s *SharedVMRuntime) NetworkCreate(ctx context.Context, name string) error
func (*SharedVMRuntime) NetworkDisconnect ¶
func (s *SharedVMRuntime) NetworkDisconnect(ctx context.Context, network, container string) error
func (*SharedVMRuntime) NetworkInspect ¶
func (*SharedVMRuntime) NetworkList ¶
func (s *SharedVMRuntime) NetworkList(ctx context.Context) ([]engine.NetworkInfo, error)
func (*SharedVMRuntime) NetworkRemove ¶
func (s *SharedVMRuntime) NetworkRemove(ctx context.Context, name string) error
func (*SharedVMRuntime) Validate ¶
func (s *SharedVMRuntime) Validate() error
Validate checks that the Apple runtime exists. The VM itself is created lazily.
func (*SharedVMRuntime) VolumeCreate ¶
func (s *SharedVMRuntime) VolumeCreate(ctx context.Context, name string) error
func (*SharedVMRuntime) VolumeInspect ¶
func (*SharedVMRuntime) VolumeList ¶
func (s *SharedVMRuntime) VolumeList(ctx context.Context) ([]engine.VolumeInfo, error)
func (*SharedVMRuntime) VolumeRemove ¶
func (s *SharedVMRuntime) VolumeRemove(ctx context.Context, name string) error
type VMState ¶
type VMState struct {
Name string `json:"name"`
Status string `json:"status"` // running, stopped
Image string `json:"image"`
Created time.Time `json:"created"`
Mounts map[string]string `json:"mounts"` // host path -> VM path
}
VMState tracks the persistent shared VM.