Documentation
¶
Overview ¶
Package vm provides the core runtime helpers for Apple Virtualization VMs.
It is the smallest useful set of abstractions for working with a running VM: queue management, VM creation and lifecycle, state queries, validation, and Objective-C retain helpers.
Higher-level packages in x/vzkit build on this package so callers can start with a narrow surface and opt into advanced runtime features only when needed.
Package vm provides queue management and lifecycle operations for virtual machines.
Index ¶
- func CanPause(queue *Queue, machine vz.VZVirtualMachine) bool
- func CanResume(queue *Queue, machine vz.VZVirtualMachine) bool
- func CanStart(queue *Queue, machine vz.VZVirtualMachine) bool
- func CanStop(queue *Queue, machine vz.VZVirtualMachine) bool
- func Create(config vz.VZVirtualMachineConfiguration, queue *Queue) vz.VZVirtualMachine
- func Pause(queue *Queue, machine vz.VZVirtualMachine, completion func(error))
- func Resume(queue *Queue, machine vz.VZVirtualMachine, completion func(error))
- func RunLoopAggressively()
- func RunLoopOnce()
- func RunLoopUntilDone(done func() bool, progress func())
- func Start(queue *Queue, machine vz.VZVirtualMachine, completion func(error))
- func State(queue *Queue, machine vz.VZVirtualMachine) vz.VZVirtualMachineState
- func Stop(queue *Queue, machine vz.VZVirtualMachine, completion func(error))
- func Validate(config vz.VZVirtualMachineConfiguration) error
- type Queue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanPause ¶
func CanPause(queue *Queue, machine vz.VZVirtualMachine) bool
CanPause reports whether the VM is in a state that allows pausing.
func CanResume ¶
func CanResume(queue *Queue, machine vz.VZVirtualMachine) bool
CanResume reports whether the VM is in a state that allows resuming.
func CanStart ¶
func CanStart(queue *Queue, machine vz.VZVirtualMachine) bool
CanStart reports whether the VM is in a state that allows starting.
func CanStop ¶
func CanStop(queue *Queue, machine vz.VZVirtualMachine) bool
CanStop reports whether the VM is in a state that allows stopping.
func Create ¶
func Create(config vz.VZVirtualMachineConfiguration, queue *Queue) vz.VZVirtualMachine
Create creates a VZVirtualMachine bound to the given dispatch queue.
func Pause ¶
func Pause(queue *Queue, machine vz.VZVirtualMachine, completion func(error))
Pause pauses a running VZVirtualMachine on its queue.
func Resume ¶
func Resume(queue *Queue, machine vz.VZVirtualMachine, completion func(error))
Resume resumes a paused VZVirtualMachine on its queue.
func RunLoopAggressively ¶
func RunLoopAggressively()
RunLoopAggressively pumps both CFRunLoop and NSRunLoop multiple times.
func RunLoopOnce ¶
func RunLoopOnce()
RunLoopOnce runs the main CFRunLoop briefly to process pending callbacks.
func RunLoopUntilDone ¶
func RunLoopUntilDone(done func() bool, progress func())
RunLoopUntilDone runs the main run loop until done returns true.
func Start ¶
func Start(queue *Queue, machine vz.VZVirtualMachine, completion func(error))
Start starts a VZVirtualMachine on its queue and calls completion with the result.
func State ¶
func State(queue *Queue, machine vz.VZVirtualMachine) vz.VZVirtualMachineState
State returns the current state of a VZVirtualMachine, dispatching to queue.
func Stop ¶
func Stop(queue *Queue, machine vz.VZVirtualMachine, completion func(error))
Stop requests a stop of a VZVirtualMachine on its queue.
func Validate ¶
func Validate(config vz.VZVirtualMachineConfiguration) error
Validate validates a VZVirtualMachineConfiguration and returns any error.
Types ¶
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue wraps a dispatch queue for VM operations. The Virtualization framework requires VM operations to happen on a specific queue.
func (*Queue) Async ¶
func (q *Queue) Async(work func())
Async executes work asynchronously on the dispatch queue.