github.com/axw/juju@v0.0.0-20161005053422-4bd6544d08d4/container/kvm/interface.go (about) 1 // Copyright 2013 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package kvm 5 6 import ( 7 "github.com/juju/juju/container" 8 ) 9 10 // StartParams is a simple parameter struct for Container.Start. 11 type StartParams struct { 12 Series string 13 Arch string 14 UserDataFile string 15 Network *container.NetworkConfig 16 Memory uint64 // MB 17 CpuCores uint64 18 RootDisk uint64 // GB 19 ImageDownloadURL string 20 } 21 22 // Container represents a virtualized container instance and provides 23 // operations to create, maintain and destroy the container. 24 type Container interface { 25 26 // Name returns the name of the container. 27 Name() string 28 29 // Start runs the container as a daemon. 30 Start(params StartParams) error 31 32 // Stop terminates the running container. 33 Stop() error 34 35 // IsRunning returns wheter or not the container is running and active. 36 IsRunning() bool 37 38 // String returns information about the container, like the name, state, 39 // and process id. 40 String() string 41 } 42 43 // ContainerFactory represents the methods used to create Containers. This 44 // wraps the low level OS functions for dealing with the containers. 45 type ContainerFactory interface { 46 // New returns a container instance which can then be used for operations 47 // like Start() and Stop() 48 New(string) Container 49 50 // List returns all the existing containers on the system. 51 List() ([]Container, error) 52 }