Documentation
¶
Index ¶
- func CaptureSnapshot(ctx context.Context, cmd *cobra.Command, snapBackend snapshot.Snapshot, ...) (string, error)
- func CloneVMConfigFromFlags(cmd *cobra.Command, snapCfg types.SnapshotConfig) (*types.VMConfig, error)
- func CloseMetaStore(ctx context.Context)
- func CloseOnCancel(ctx context.Context, c io.Closer) func() bool
- func EnsureFirmwarePath(conf *config.Config, bootCfg *types.BootConfig)
- func EnsureImage(ctx context.Context, backends []imagebackend.Images, vmCfg *types.VMConfig)
- func EnsureSnapshotNameFree(ctx context.Context, snapBackend snapshot.Snapshot, name string) error
- func FindHypervisor(ctx context.Context, conf *config.Config, ref string) (hypervisor.Hypervisor, error)
- func InitAllHypervisors(ctx context.Context, conf *config.Config) ([]hypervisor.Hypervisor, error)
- func InitBridgeNetwork(conf *config.Config, bridgeDev string) (network.Network, error)
- func InitHypervisor(ctx context.Context, conf *config.Config) (hypervisor.Hypervisor, error)
- func InitImageBackends(ctx context.Context, conf *config.Config) ([]imagebackend.Images, error)
- func InitImageBackendsForPull(ctx context.Context, conf *config.Config) (*oci.OCI, *cloudimg.CloudImg, error)
- func InitNetwork(conf *config.Config) (network.Network, error)
- func InitSnapshot(ctx context.Context, conf *config.Config, opts ...localfile.Option) (snapshot.Snapshot, error)
- func LegacyJSONPresent(conf *config.Config) bool
- func ListAllVMs(ctx context.Context, hypers []hypervisor.Hypervisor) ([]*types.VM, error)
- func MetaDBPath(conf *config.Config) string
- func MetaJSONNamespaces(conf *config.Config) []metajson.Namespace
- func MetaNamespaces() []metasqlite.Namespace
- func MetaStore(conf *config.Config) (meta.Store, error)
- func MeteringRecorder(ctx context.Context, conf *config.Config) metering.Recorder
- func NewGCOrchestrator(ctx context.Context, conf *config.Config, snapOpts ...localfile.Option) (*gc.Orchestrator, error)
- func ParseDirectIO(val string) (*bool, error)
- func PersistSnapshotDir(ctx context.Context, snapBackend snapshot.Snapshot, cfg *types.SnapshotConfig, ...) (string, error)
- func PersistSnapshotStream(ctx context.Context, snapBackend snapshot.Snapshot, cfg *types.SnapshotConfig, ...) (string, error)
- func PinEnvelopeBlobs(ctx context.Context, conf *config.Config, blobIDs map[string]struct{}) (func(), error)
- func ReconcileState(vm *types.VM) string
- func ResolveImage(ctx context.Context, backends []imagebackend.Images, vmCfg *types.VMConfig) ([]*types.StorageConfig, *types.BootConfig, error)
- func ResolveImageOwner(ctx context.Context, backends []imagebackend.Images, ref string) (imagebackend.Images, error)
- func ResolveMetaBackend(conf *config.Config) string
- func RestoreVMConfigFromFlags(cmd *cobra.Command, vm *types.VM, snapCfg types.SnapshotConfig) (*types.VMConfig, error)
- func RouteRefs(ctx context.Context, hypers []hypervisor.Hypervisor, refs []string) (map[hypervisor.Hypervisor][]string, error)
- func SnapshotNameFlags(ctx context.Context, cmd *cobra.Command, snapBackend snapshot.Snapshot) (name, description string, err error)
- func VMConfigFromFlags(cmd *cobra.Command, image string) (*types.VMConfig, error)
- type BaseHandler
- type NetProviders
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CaptureSnapshot ¶ added in v0.4.8
func CaptureSnapshot(ctx context.Context, cmd *cobra.Command, snapBackend snapshot.Snapshot, capture func() (*types.SnapshotConfig, string, error)) (string, error)
CaptureSnapshot checks the --name preflight, runs capture, and persists the capture dir, returning the stored snapshot id.
func CloneVMConfigFromFlags ¶
func CloseMetaStore ¶ added in v0.5.4
CloseMetaStore ends the store's unified lifecycle at command teardown (design §10 P0); a process that never opened it is a no-op.
func CloseOnCancel ¶ added in v0.4.1
CloseOnCancel closes c when ctx is canceled; callers `defer CloseOnCancel(ctx, c)()` to stop the watcher on return.
func EnsureFirmwarePath ¶
func EnsureFirmwarePath(conf *config.Config, bootCfg *types.BootConfig)
func EnsureImage ¶ added in v0.3.6
EnsureImage pulls the digest-pinned base if missing; only warns so VerifyBaseFiles surfaces the real error for imported images.
func EnsureSnapshotNameFree ¶ added in v0.4.8
EnsureSnapshotNameFree validates name and rejects a duplicate; empty passes.
func FindHypervisor ¶ added in v0.2.9
func FindHypervisor(ctx context.Context, conf *config.Config, ref string) (hypervisor.Hypervisor, error)
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 InitHypervisor ¶
func InitHypervisor(ctx context.Context, conf *config.Config) (hypervisor.Hypervisor, error)
func InitImageBackends ¶
func InitSnapshot ¶
func LegacyJSONPresent ¶ added in v0.5.6
LegacyJSONPresent reports whether any json-engine namespace file exists under the root — data a fresh sqlite store must never shadow.
func ListAllVMs ¶ added in v0.2.9
func ListAllVMs(ctx context.Context, hypers []hypervisor.Hypervisor) ([]*types.VM, error)
func MetaDBPath ¶ added in v0.5.4
MetaDBPath is the sqlite engine's database under the meta root.
func MetaJSONNamespaces ¶ added in v0.5.4
MetaJSONNamespaces declares the json engine's namespace set: legacy file locations and field mappings, consumed by open and by conversion.
func MetaNamespaces ¶ added in v0.5.4
func MetaNamespaces() []metasqlite.Namespace
MetaNamespaces lists every namespace with its tables — the engine-neutral declaration both engines consume.
func MetaStore ¶ added in v0.5.4
MetaStore builds the process-wide meta store once — one store, every namespace — and injects it into every backend (design §10 P0 boundary). The engine follows ResolveMetaBackend; a fresh sqlite root bootstraps itself.
func MeteringRecorder ¶ added in v0.4.1
MeteringRecorder returns the process-wide recorder per conf.Metering.Backend; lazy-init shared across callers.
func NewGCOrchestrator ¶ added in v0.5.5
func NewGCOrchestrator(ctx context.Context, conf *config.Config, snapOpts ...localfile.Option) (*gc.Orchestrator, error)
NewGCOrchestrator registers every collector; both hypervisor backends join so a sweep protects blobs pinned by either.
func ParseDirectIO ¶ added in v0.4.9
ParseDirectIO maps a directio value (on/off/auto) to the tri-state StorageConfig.DirectIO; auto is nil.
func PersistSnapshotDir ¶ added in v0.4.9
func PersistSnapshotDir(ctx context.Context, snapBackend snapshot.Snapshot, cfg *types.SnapshotConfig, srcDir, name, description string) (string, error)
PersistSnapshotDir stores a finalized capture dir, preferring a direct in-place move (DirectCreator) when srcDir shares a filesystem with the backend's data dir, and falling back to a tar stream otherwise (cross-filesystem, or a backend without DirectCreator such as a remote store). srcDir is consumed on every path.
func PersistSnapshotStream ¶ added in v0.4.8
func PersistSnapshotStream(ctx context.Context, snapBackend snapshot.Snapshot, cfg *types.SnapshotConfig, stream io.ReadCloser, name, description string) (string, error)
PersistSnapshotStream labels cfg and stores the stream, closing it either way.
func PinEnvelopeBlobs ¶ added in v0.5.4
func PinEnvelopeBlobs(ctx context.Context, conf *config.Config, blobIDs map[string]struct{}) (func(), error)
PinEnvelopeBlobs locks envelope-sourced pins (clone/restore --from-dir, snapshot import) on the owning backend; digests with no local blob are skipped.
func ReconcileState ¶
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 ResolveMetaBackend ¶ added in v0.5.6
ResolveMetaBackend returns the effective engine: an explicit setting wins, then an existing store binds (meta.db → sqlite, legacy json files → json), and a fresh root gets sqlite.
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).
Types ¶
type BaseHandler ¶
type NetProviders ¶ added in v0.5.5
type NetProviders struct {
// contains filtered or unexported fields
}
NetProviders resolves and caches the network provider each VM's record names.
func NetworkSeam ¶ added in v0.5.5
func NetworkSeam(conf *config.Config) *NetProviders
NetworkSeam returns the process-wide seam, so both backends share one provider cache.
func (*NetProviders) Cleanup ¶ added in v0.5.5
func (n *NetProviders) Cleanup(ctx context.Context, vmID string) error
A partial CNI failure leaves the tombstone for retry or GC to resume.
func (*NetProviders) ForVM ¶ added in v0.5.5
ForVM picks the provider from the VM's persisted network state.