github.com/kata-containers/runtime@v0.0.0-20210505125100-04f29832a923/virtcontainers/factory.go (about) 1 // Copyright (c) 2018 HyperHQ Inc. 2 // 3 // SPDX-License-Identifier: Apache-2.0 4 // 5 6 package virtcontainers 7 8 import ( 9 "context" 10 11 pb "github.com/kata-containers/runtime/protocols/cache" 12 ) 13 14 // Factory controls how a new VM is created. 15 type Factory interface { 16 // Config returns base factory config. 17 Config() VMConfig 18 19 // GetVMStatus returns the status of the paused VM created by the base factory. 20 GetVMStatus() []*pb.GrpcVMStatus 21 22 // GetVM gets a new VM from the factory. 23 GetVM(ctx context.Context, config VMConfig) (*VM, error) 24 25 // GetBaseVM returns a paused VM created by the base factory. 26 GetBaseVM(ctx context.Context, config VMConfig) (*VM, error) 27 28 // CloseFactory closes and cleans up the factory. 29 CloseFactory(ctx context.Context) 30 }