github.com/mattyw/juju@v0.0.0-20140610034352-732aecd63861/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 } 20 21 // Container represents a virtualized container instance and provides 22 // operations to create, maintain and destroy the container. 23 type Container interface { 24 25 // Name returns the name of the container. 26 Name() string 27 28 // Start runs the container as a daemon. 29 Start(params StartParams) error 30 31 // Stop terminates the running container. 32 Stop() error 33 34 // IsRunning returns wheter or not the container is running and active. 35 IsRunning() bool 36 37 // String returns information about the container, like the name, state, 38 // and process id. 39 String() string 40 } 41 42 // ContainerFactory represents the methods used to create Containers. This 43 // wraps the low level OS functions for dealing with the containers. 44 type ContainerFactory interface { 45 // New returns a container instance which can then be used for operations 46 // like Start() and Stop() 47 New(string) Container 48 49 // List returns all the existing containers on the system. 50 List() ([]Container, error) 51 }