launchpad.net/~rogpeppe/juju-core/500-errgo-fix@v0.0.0-20140213181702-000000002356/container/interface.go (about)

     1  // Copyright 2013 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package container
     5  
     6  import (
     7  	"launchpad.net/juju-core/environs/cloudinit"
     8  	"launchpad.net/juju-core/instance"
     9  )
    10  
    11  // ManagerConfig contains the initialization parameters for the ContainerManager.
    12  // The name of the manager is used to namespace the containers on the machine.
    13  type ManagerConfig struct {
    14  	Name   string
    15  	LogDir string
    16  }
    17  
    18  // Manager is responsible for starting containers, and stopping and listing
    19  // containers that it has started.
    20  type Manager interface {
    21  	// StartContainer creates and starts a new container for the specified machine.
    22  	StartContainer(
    23  		machineConfig *cloudinit.MachineConfig,
    24  		series string,
    25  		network *NetworkConfig) (instance.Instance, *instance.HardwareCharacteristics, error)
    26  	// StopContainer stops and destroyes the container identified by Instance.
    27  	StopContainer(instance.Instance) error
    28  	// ListContainers return a list of containers that have been started by
    29  	// this manager.
    30  	ListContainers() ([]instance.Instance, error)
    31  }
    32  
    33  // Initialiser is responsible for performing the steps required to initialise
    34  // a host machine so it can run containers.
    35  type Initialiser interface {
    36  	// Initialise installs all required packages, sync any images etc so
    37  	// that the host machine can run containers.
    38  	Initialise() error
    39  }