sharedvm

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultMounts

func DefaultMounts(workspaceDirs []string) map[string]string

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

func MountFlags(mounts map[string]string) []string

MountFlags returns -v flags for VM creation from the mount mapping.

func SaveVMState

func SaveVMState(s *VMState) error

func TranslatePath

func TranslatePath(hostPath string, mounts map[string]string) string

TranslatePath converts a host-absolute path to its VM-internal path. Returns the original path if no mount covers it.

func TranslateVolumeSpec

func TranslateVolumeSpec(spec string, mounts map[string]string) string

TranslateVolumeSpec rewrites a volume spec's host path. e.g., "/Users/me/app/src:/app/src" → "/host/Users/me/app/src:/app/src" Bind mounts (starting with / or .) are translated; named volumes are left alone.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles the lifecycle of the persistent shared VM.

func NewManager

func NewManager(apple engine.Runtime, cfg config.SharedVM) *Manager

func (*Manager) EnsureRunning

func (m *Manager) EnsureRunning(ctx context.Context) error

EnsureRunning ensures the shared VM is running, creating it if needed.

func (*Manager) Mounts

func (m *Manager) Mounts() map[string]string

Mounts returns the host→VM path mappings.

func (*Manager) Remove

func (m *Manager) Remove(ctx context.Context) error

Remove force-removes the shared VM and cleans up state.

func (*Manager) Status

func (m *Manager) Status(ctx context.Context) string

Status returns the current VM status: "running", "stopped", or "".

func (*Manager) Stop

func (m *Manager) Stop(ctx context.Context) error

Stop stops the shared VM.

func (*Manager) VMIP added in v0.5.0

func (m *Manager) VMIP(ctx context.Context) string

VMIP returns the shared VM's IP address, or "" if unavailable.

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 (s *SharedVMRuntime) ContainerExec(ctx context.Context, nameOrID string, args []string, interactive bool) error

func (*SharedVMRuntime) ContainerInspect

func (s *SharedVMRuntime) ContainerInspect(ctx context.Context, nameOrID string) ([]byte, error)

func (*SharedVMRuntime) ContainerList

func (s *SharedVMRuntime) ContainerList(ctx context.Context, all bool) ([]engine.ContainerInfo, error)

func (*SharedVMRuntime) ContainerLogs

func (s *SharedVMRuntime) ContainerLogs(ctx context.Context, nameOrID string, follow bool) error

func (*SharedVMRuntime) ContainerRemove

func (s *SharedVMRuntime) ContainerRemove(ctx context.Context, nameOrID string, force bool) error

func (*SharedVMRuntime) ContainerRun

func (s *SharedVMRuntime) ContainerRun(ctx context.Context, args []string, interactive bool) error

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) Exec

func (s *SharedVMRuntime) Exec(ctx context.Context, args ...string) ([]byte, []byte, 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) ImageList

func (s *SharedVMRuntime) ImageList(ctx context.Context) ([]engine.ImageInfo, error)

func (*SharedVMRuntime) ImagePull

func (s *SharedVMRuntime) ImagePull(ctx context.Context, image string) 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 (s *SharedVMRuntime) NetworkInspect(ctx context.Context, name string) ([]byte, error)

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 (s *SharedVMRuntime) VolumeInspect(ctx context.Context, name string) ([]byte, error)

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.

func LoadVMState

func LoadVMState() (*VMState, error)

Jump to

Keyboard shortcuts

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