core

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFormatFlag

func AddFormatFlag(cmd *cobra.Command)

func AddOutputFlag added in v0.3.7

func AddOutputFlag(cmd *cobra.Command)

func CloneVMConfigFromFlags

func CloneVMConfigFromFlags(cmd *cobra.Command, snapCfg types.SnapshotConfig) (*types.VMConfig, error)

func CloseOnCancel added in v0.4.1

func CloseOnCancel(ctx context.Context, c io.Closer) func() bool

CloseOnCancel closes c when ctx is canceled; callers `defer CloseOnCancel(ctx, c)()` to stop the watcher on return.

func CommandContext

func CommandContext(cmd *cobra.Command) context.Context

func EnsureFirmwarePath

func EnsureFirmwarePath(conf *config.Config, bootCfg *types.BootConfig)

func EnsureImage added in v0.3.6

func EnsureImage(ctx context.Context, backends []imagebackend.Images, vmCfg *types.VMConfig)

EnsureImage pulls the digest-pinned base if missing; only warns so VerifyBaseFiles surfaces the real error for imported images.

func FindHypervisor added in v0.2.9

func FindHypervisor(ctx context.Context, conf *config.Config, ref string) (hypervisor.Hypervisor, error)

func FormatSize

func FormatSize(bytes int64) string

func InitAllHypervisors added in v0.2.9

func InitAllHypervisors(ctx context.Context, conf *config.Config) ([]hypervisor.Hypervisor, error)

func InitBridgeNetwork added in v0.3.2

func InitBridgeNetwork(conf *config.Config, bridgeDev string) (network.Network, error)

func InitHypervisor

func InitHypervisor(ctx context.Context, conf *config.Config) (hypervisor.Hypervisor, error)

func InitImageBackends

func InitImageBackends(ctx context.Context, conf *config.Config) ([]imagebackend.Images, error)

func InitImageBackendsForPull

func InitImageBackendsForPull(ctx context.Context, conf *config.Config) (*oci.OCI, *cloudimg.CloudImg, error)

func InitNetwork

func InitNetwork(conf *config.Config) (network.Network, error)

func InitSnapshot

func InitSnapshot(ctx context.Context, conf *config.Config, opts ...localfile.Option) (snapshot.Snapshot, error)

func IsURL

func IsURL(ref string) bool

func ListAllVMs added in v0.2.9

func ListAllVMs(ctx context.Context, hypers []hypervisor.Hypervisor) ([]*types.VM, error)

func MaybeOutputJSON added in v0.3.7

func MaybeOutputJSON(cmd *cobra.Command, v any) (bool, error)

MaybeOutputJSON emits JSON iff --output=json; (true, _) means caller should stop logging.

func MeteringRecorder added in v0.4.1

func MeteringRecorder(ctx context.Context, conf *config.Config) metering.Recorder

MeteringRecorder returns the process-wide recorder per conf.Metering.Backend; lazy-init shared across callers.

func OutputFormatted

func OutputFormatted(cmd *cobra.Command, data any, tableFn func(w *tabwriter.Writer)) error

func OutputJSON

func OutputJSON(v any) error

func ReconcileState

func ReconcileState(vm *types.VM) string

func ResolveImage

func ResolveImage(ctx context.Context, backends []imagebackend.Images, vmCfg *types.VMConfig) ([]*types.StorageConfig, *types.BootConfig, error)

func ResolveImageOwner added in v0.3.1

func ResolveImageOwner(ctx context.Context, backends []imagebackend.Images, ref string) (imagebackend.Images, error)

func RestoreVMConfigFromFlags

func RestoreVMConfigFromFlags(cmd *cobra.Command, vm *types.VM, snapCfg types.SnapshotConfig) (*types.VMConfig, error)

RestoreVMConfigFromFlags builds VMConfig for restore: resources from the snapshot, Name/Network from the VM (CNI namespace survives restore).

func RouteRefs added in v0.2.9

func RouteRefs(ctx context.Context, hypers []hypervisor.Hypervisor, refs []string) (map[hypervisor.Hypervisor][]string, error)

RouteRefs resolves user refs to (hypervisor → full VM IDs).

func VMConfigFromFlags

func VMConfigFromFlags(cmd *cobra.Command, image string) (*types.VMConfig, error)

func WantJSON added in v0.3.7

func WantJSON(cmd *cobra.Command) bool

Types

type BaseHandler

type BaseHandler struct {
	ConfProvider func() *config.Config
}

func NewBaseHandler

func NewBaseHandler(conf *config.Config) BaseHandler

func (BaseHandler) Conf

func (h BaseHandler) Conf() (*config.Config, error)

func (BaseHandler) Init

Jump to

Keyboard shortcuts

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