cluster

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2015 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SerializeNode

func SerializeNode(node Node) string

SerializeNode is exported

Types

type Cluster

type Cluster interface {
	// Create a container
	CreateContainer(config *dockerclient.ContainerConfig, name string) (*Container, error)

	// Remove a container
	RemoveContainer(container *Container, force bool) error

	// Return all images
	Images() []*Image

	// Return one image matching `IDOrName`
	Image(IDOrName string) *Image

	// Remove an image from the cluster
	RemoveImage(image *Image) ([]*dockerclient.ImageDelete, error)

	// Return all containers
	Containers() []*Container

	// Return container the matching `IDOrName`
	Container(IDOrName string) *Container

	// Pull images
	// `callback` can be called multiple time
	//  `what` is what is being pulled
	//  `status` is the current status, like "", "in progress" or "downloaded
	Pull(name string, callback func(what, status string))

	// Return some info about the cluster, like nb or containers / images
	// It is pretty open, so the implementation decides what to return.
	Info() [][2]string
}

Cluster is exported

type Container

type Container struct {
	dockerclient.Container

	Info dockerclient.ContainerInfo
	Node Node
}

Container is exported

type Event

type Event struct {
	dockerclient.Event
	Node Node
}

Event is exported

type EventHandler

type EventHandler interface {
	Handle(*Event) error
}

EventHandler is exported

type Image

type Image struct {
	dockerclient.Image

	Node Node
}

Image is exported

func (*Image) Match

func (image *Image) Match(IDOrName string) bool

Match is exported

type Node

type Node interface {
	ID() string
	Name() string

	IP() string   //to inject the actual IP of the machine in docker ps (hostname:port or ip:port)
	Addr() string //to know where to connect with the proxy

	Images() []*Image                     //used by the API
	Image(IDOrName string) *Image         //used by the filters
	Containers() []*Container             //used by the filters
	Container(IDOrName string) *Container //used by the filters

	TotalCpus() int64   //used by the strategy
	UsedCpus() int64    //used by the strategy
	TotalMemory() int64 //used by the strategy
	UsedMemory() int64  //used by the strategy

	Labels() map[string]string //used by the filters

	IsHealthy() bool
}

Node is exported

type NodeSorter

type NodeSorter []Node

NodeSorter implements the Sort interface to sort Cluster.Node. It is not guaranteed to be a stable sort.

func (NodeSorter) Len

func (s NodeSorter) Len() int

Len returns the number of nodes to be sorted.

func (NodeSorter) Less

func (s NodeSorter) Less(i, j int) bool

Less reports whether the node with index i should sort before the node with index j. Nodes are sorted chronologically by name.

func (NodeSorter) Swap

func (s NodeSorter) Swap(i, j int)

Swap exchanges the node elements with indices i and j.

type Options

type Options struct {
	TLSConfig       *tls.Config
	OvercommitRatio float64
	Discovery       string
	Heartbeat       int
}

Options is exported

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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