engine

package
v0.0.0-...-6f0cfeb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2014 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterNode

type ClusterNode struct {
	Id      string `json:"id" yaml:"id"`
	Address string `json:"address" yaml:"address"`
}

/////////////////////////////////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////////////////////////////////

type Container

type Container struct {
	// contains filtered or unexported fields
}

func NewContainerFromTemplate

func NewContainerFromTemplate(tmp Template, node *Node) (*Container, error)

/////////////////////////////////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////////////////////////////////

func (*Container) FullQualifiedName

func (cnt *Container) FullQualifiedName() string

/////////////////////////////////////////////////////////////////////////////////////////////// // FullQualifiedName ///////////////////////////////////////////////////////////////////////////////////////////////

func (*Container) RemoveSelfReference

func (cnt *Container) RemoveSelfReference()

/////////////////////////////////////////////////////////////////////////////////////////////// // RemoveSelfReference ///////////////////////////////////////////////////////////////////////////////////////////////

func (*Container) SetId

func (cnt *Container) SetId(id string)

/////////////////////////////////////////////////////////////////////////////////////////////// // SetId ///////////////////////////////////////////////////////////////////////////////////////////////

func (*Container) String

func (cnt *Container) String() string

////////////////////////////////////////////////////////////////////////////////////////////// String ///////////////////////////////////////////////////////////////////////////////////////////////

type ContainerAggregateFunc

type ContainerAggregateFunc func(e *list.Element, val interface{}) interface{}

type ContainerFunc

type ContainerFunc func(e *list.Element) error

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

func NewEngine

func NewEngine() (*Engine, error)

///////////////////////////////////////////////////////////////////////////////////////////// NewEngine /////////////////////////////////////////////////////////////////////////////////////////////

func (*Engine) Execute

func (e *Engine) Execute(fn EngineFunc) error

///////////////////////////////////////////////////////////////////////////////////////////// Execute /////////////////////////////////////////////////////////////////////////////////////////////

func (*Engine) ForAllNodes

func (e *Engine) ForAllNodes(fn EngineFunc) error

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*Engine) LoadDefaults

func (e *Engine) LoadDefaults(group string) error

///////////////////////////////////////////////////////////////////////////////////////////// LoadFromFile /////////////////////////////////////////////////////////////////////////////////////////////

func (*Engine) LoadFromFile

func (e *Engine) LoadFromFile(path, group string) error

///////////////////////////////////////////////////////////////////////////////////////////// LoadFromFile /////////////////////////////////////////////////////////////////////////////////////////////

type EngineFunc

type EngineFunc func(cont Node) error

type Manifest

type Manifest struct {
	Id        string              `json:"manifest-id" yaml:"manifest-id"`
	Templates []Template          `json:"containers" yaml:"containers"`
	Groups    map[string][]string `json:"groups" yaml:"groups"`
	Nodes     []ClusterNode       `json:"nodes" yaml:"nodes"`
}

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*Manifest) GetTemplateNamesByGroup

func (m *Manifest) GetTemplateNamesByGroup(group string) []string

///////////////////////////////////////////////////////////////////////////////////////////// GetContainerNamesByGroup /////////////////////////////////////////////////////////////////////////////////////////////

func (*Manifest) GetTemplatesByNames

func (m *Manifest) GetTemplatesByNames(names []string) []Template

///////////////////////////////////////////////////////////////////////////////////////////// GetContainersByNames /////////////////////////////////////////////////////////////////////////////////////////////

type ManifestLoader

type ManifestLoader struct {
	// contains filtered or unexported fields
}

func (*ManifestLoader) LoadDefault

func (m *ManifestLoader) LoadDefault() (*Manifest, error)

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*ManifestLoader) LoadFromFile

func (m *ManifestLoader) LoadFromFile(filename string) (*Manifest, error)

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*ManifestLoader) LoadRaw

func (m *ManifestLoader) LoadRaw(rawManifest string) (*Manifest, error)

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node represents a host running Docker. Each node has an ID and an address (in the form <scheme>://<host>:<port>/).

func NewNode

func NewNode(id, address, manId string, e *Engine, tmps []Template) (*Node, error)

/////////////////////////////////////////////////////////////////////////////////////////////// NewNode ///////////////////////////////////////////////////////////////////////////////////////////////

func (Node) Aggregate

func (n Node) Aggregate(val interface{}, fn ContainerAggregateFunc) interface{}

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (Node) Apply

func (n Node) Apply(tmps []Template) error

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (Node) ApplyState

func (n Node) ApplyState(cnts []docker.APIContainers) error

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (Node) ForAll

func (n Node) ForAll(fn ContainerFunc) error

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (Node) ForAllReversed

func (n Node) ForAllReversed(fn ContainerFunc) error

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (Node) HasContainers

func (n Node) HasContainers() bool

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (Node) Info1

func (n Node) Info1() string

/////////////////////////////////////////////////////////////////////////////////////////////// Info1 ///////////////////////////////////////////////////////////////////////////////////////////////

func (Node) Kill

func (n Node) Kill() error

///////////////////////////////////////////////////////////////////////////////////////////// Kill containers. /////////////////////////////////////////////////////////////////////////////////////////////

func (Node) Lift

func (n Node) Lift(force bool, kill bool) error

///////////////////////////////////////////////////////////////////////////////////////////// Lift containers (provision + run). When forced, this will rebuild all images and recreate all containers. /////////////////////////////////////////////////////////////////////////////////////////////

func (Node) Provision

func (n Node) Provision(force bool) error

///////////////////////////////////////////////////////////////////////////////////////////// Provision containers. When forced, this will rebuild all images. /////////////////////////////////////////////////////////////////////////////////////////////

func (Node) Remove

func (n Node) Remove(force bool, kill bool) error

///////////////////////////////////////////////////////////////////////////////////////////// Remove containers. When forced, stops existing containers first. /////////////////////////////////////////////////////////////////////////////////////////////

func (Node) Run

func (n Node) Run(force bool, kill bool) error

///////////////////////////////////////////////////////////////////////////////////////////// Run containers. When forced, removes existing containers first. /////////////////////////////////////////////////////////////////////////////////////////////

func (Node) Start

func (n Node) Start() error

///////////////////////////////////////////////////////////////////////////////////////////// Start containers. /////////////////////////////////////////////////////////////////////////////////////////////

func (Node) Status

func (n Node) Status() error

///////////////////////////////////////////////////////////////////////////////////////////// Status of containers. /////////////////////////////////////////////////////////////////////////////////////////////

func (Node) Stop

func (n Node) Stop() error

///////////////////////////////////////////////////////////////////////////////////////////// Stop containers. /////////////////////////////////////////////////////////////////////////////////////////////

func (Node) String

func (n Node) String() string

/////////////////////////////////////////////////////////////////////////////////////////////// String ///////////////////////////////////////////////////////////////////////////////////////////////

type RunParameters

type RunParameters struct {
	RawCidfile     string      `json:"cidfile" yaml:"cidfile"`
	CpuShares      int         `json:"cpu-shares" yaml:"cpu-shares"`
	RawDns         []string    `json:"dns" yaml:"dns"`
	RawEntrypoint  []string    `json:"entrypoint" yaml:"entrypoint"`
	RawEnv         []string    `json:"env" yaml:"env"`
	RawEnvFile     string      `json:"env-file" yaml:"env-file"`
	RawExpose      []string    `json:"expose" yaml:"expose"`
	RawHostname    string      `json:"hostname" yaml:"hostname"`
	Interactive    bool        `json:"interactive" yaml:"interactive"`
	RawLink        []string    `json:"link" yaml:"link"`
	RawLxcConf     []string    `json:"lxc-conf" yaml:"lxc-conf"`
	RawMemory      string      `json:"memory" yaml:"memory"`
	RawMemorySwap  string      `json:"memory-swap" yaml:"memory-swap"`
	RawNet         string      `json:"net" yaml:"net"`
	Privileged     bool        `json:"privileged" yaml:"privileged"`
	RawPorts       []string    `json:"ports" yaml:"ports"`
	PublishAll     bool        `json:"publish-all" yaml:"publish-all"`
	Rm             bool        `json:"rm" yaml:"rm"`
	Tty            bool        `json:"tty" yaml:"tty"`
	RawUser        string      `json:"user" yaml:"user"`
	RawBinds       []string    `json:"binds" yaml:"binds"`
	RawVolumesFrom string      `json:"volumes-from" yaml:"volumes-from"`
	RawWorkdir     string      `json:"workdir" yaml:"workdir"`
	RawCmd         interface{} `json:"cmd" yaml:"cmd"`
}

func (*RunParameters) Binds

func (r *RunParameters) Binds() []string

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*RunParameters) Cidfile

func (r *RunParameters) Cidfile() string

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*RunParameters) Cmd

func (r *RunParameters) Cmd() ([]string, error)

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*RunParameters) CreateDockerConfig

func (r *RunParameters) CreateDockerConfig() (*docker.Config, error)

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*RunParameters) CreateDockerHostConfig

func (r *RunParameters) CreateDockerHostConfig() (*docker.HostConfig, error)

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*RunParameters) Dns

func (r *RunParameters) Dns() []string

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*RunParameters) Entrypoint

func (r *RunParameters) Entrypoint() []string

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*RunParameters) Env

func (r *RunParameters) Env() []string

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*RunParameters) EnvFile

func (r *RunParameters) EnvFile() string

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*RunParameters) Expose

func (r *RunParameters) Expose() []string

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*RunParameters) ExposedPorts

func (r *RunParameters) ExposedPorts() map[docker.Port]struct{}

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*RunParameters) Hostname

func (r *RunParameters) Hostname() string

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (r *RunParameters) Link() []string

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*RunParameters) LxcConf

func (r *RunParameters) LxcConf() []docker.KeyValuePair

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*RunParameters) Memory

func (r *RunParameters) Memory() string

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*RunParameters) MemorySwap

func (r *RunParameters) MemorySwap() string

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*RunParameters) Net

func (r *RunParameters) Net() string

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*RunParameters) PortBindings

func (r *RunParameters) PortBindings() map[docker.Port][]docker.PortBinding

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*RunParameters) PortMappings

func (r *RunParameters) PortMappings() []string

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*RunParameters) User

func (r *RunParameters) User() string

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*RunParameters) Volumes

func (r *RunParameters) Volumes() map[string]struct{}

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*RunParameters) VolumesFrom

func (r *RunParameters) VolumesFrom() string

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*RunParameters) WorkingDir

func (r *RunParameters) WorkingDir() string

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

type Template

type Template struct {
	RawName      string   `json:"name" yaml:"name"`
	RawImage     string   `json:"image" yaml:"image"`
	Requirements []string `json:"required" yaml:"required"`
	Run          RunParameters
}

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*Template) Image

func (tmp *Template) Image() string

/////////////////////////////////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////////////////////////////////

func (*Template) Name

func (tmp *Template) Name() string

/////////////////////////////////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////////////////////////////////

type Tree

type Tree struct {
	// contains filtered or unexported fields
}

func NewTree

func NewTree() *Tree

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*Tree) AddUnmetRequirement

func (t *Tree) AddUnmetRequirement(name string)

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*Tree) First

func (t *Tree) First() *list.Element

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*Tree) GetContainerByName

func (t *Tree) GetContainerByName(name string) interface{}

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*Tree) GetIndex

func (t *Tree) GetIndex(cont interface{}) int

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*Tree) Last

func (t *Tree) Last() *list.Element

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*Tree) Length

func (t *Tree) Length() int

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*Tree) RemoveUnmetRequirement

func (t *Tree) RemoveUnmetRequirement(name string)

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*Tree) TreeInsertAfter

func (t *Tree) TreeInsertAfter(cont Container, elm *list.Element) *list.Element

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*Tree) TreeInsertBefore

func (t *Tree) TreeInsertBefore(cont Container, elm *list.Element) *list.Element

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

func (*Tree) TreePushBack

func (t *Tree) TreePushBack(cont Container) *list.Element

/////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL