gitee.com/leisunstar/runtime@v0.0.0-20200521203717-5cef3e7b53f9/virtcontainers/factory/base/base.go (about) 1 // Copyright (c) 2018 HyperHQ Inc. 2 // 3 // SPDX-License-Identifier: Apache-2.0 4 // 5 6 package base 7 8 import ( 9 "context" 10 11 pb "github.com/kata-containers/runtime/protocols/cache" 12 vc "github.com/kata-containers/runtime/virtcontainers" 13 ) 14 15 // FactoryBase is vm factory's internal base factory interfaces. 16 // The difference between FactoryBase and Factory is that the Factory 17 // also handles vm config validation/comparison and possible CPU/memory 18 // hotplugs. It's better to do it at the factory level instead of doing 19 // the same work in each of the factory implementations. 20 type FactoryBase interface { 21 // Config returns base factory config. 22 Config() vc.VMConfig 23 24 // GetVMStatus returns the status of the paused VM created by the base factory. 25 GetVMStatus() []*pb.GrpcVMStatus 26 27 // GetBaseVM returns a paused VM created by the base factory. 28 GetBaseVM(ctx context.Context, config vc.VMConfig) (*vc.VM, error) 29 30 // CloseFactory closes the base factory. 31 CloseFactory(ctx context.Context) 32 }