swarm

package
v0.0.0-...-f8db6a6 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2015 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCluster

func NewCluster(scheduler *scheduler.Scheduler, store *state.Store, eventhandler cluster.EventHandler, options *cluster.Options) cluster.Cluster

Types

type Node

type Node struct {
	sync.RWMutex

	Cpus   int64
	Memory int64
	// contains filtered or unexported fields
}

func NewNode

func NewNode(addr string, overcommitRatio float64) *Node

func (*Node) AddContainer

func (n *Node) AddContainer(container *cluster.Container) error

Inject a container into the internal state.

func (*Node) AddImage

func (n *Node) AddImage(image *cluster.Image)

Inject an image into the internal state.

func (*Node) Addr

func (n *Node) Addr() string

func (*Node) CleanupContainers

func (n *Node) CleanupContainers()

Wipes the internal container state.

func (*Node) Connect

func (n *Node) Connect(config *tls.Config) error

Connect will initialize a connection to the Docker daemon running on the host, gather machine specs (memory, cpu, ...) and monitor state changes.

func (*Node) Container

func (n *Node) Container(IdOrName string) *cluster.Container

Container returns the container with IdOrName in the node.

func (*Node) Containers

func (n *Node) Containers() []*cluster.Container

Containers returns all the containers in the node.

func (*Node) Create

func (n *Node) Create(config *dockerclient.ContainerConfig, name string, pullImage bool) (*cluster.Container, error)

func (*Node) Destroy

func (n *Node) Destroy(container *cluster.Container, force bool) error

Destroy and remove a container from the node.

func (*Node) Events

func (n *Node) Events(h cluster.EventHandler) error

Register an event handler.

func (*Node) ID

func (n *Node) ID() string

func (*Node) IP

func (n *Node) IP() string

func (*Node) Image

func (n *Node) Image(IdOrName string) *cluster.Image

Image returns the image with IdOrName in the node

func (*Node) Images

func (n *Node) Images() []*cluster.Image

func (*Node) IsConnected

func (n *Node) IsConnected() bool

IsConnected returns true if the engine is connected to a remote docker API

func (*Node) IsHealthy

func (n *Node) IsHealthy() bool

func (*Node) Labels

func (n *Node) Labels() map[string]string

func (*Node) Name

func (n *Node) Name() string

func (*Node) Pull

func (n *Node) Pull(image string) error

func (*Node) RefreshContainer

func (n *Node) RefreshContainer(ID string, full bool) error

Refresh the status of a container running on the node. If `full` is true, the container will be inspected.

func (*Node) RefreshContainers

func (n *Node) RefreshContainers(full bool) error

Refresh the list and status of containers running on the node. If `full` is true, each container will be inspected.

func (*Node) RefreshContainersAsync

func (n *Node) RefreshContainersAsync()

func (*Node) RemoveContainer

func (n *Node) RemoveContainer(container *cluster.Container) error

Remove a container from the internal test.

func (*Node) String

func (n *Node) String() string

func (*Node) TotalCpus

func (n *Node) TotalCpus() int64

func (*Node) TotalMemory

func (n *Node) TotalMemory() int64

func (*Node) UsedCpus

func (n *Node) UsedCpus() int64

Return the sum of CPUs reserved by containers.

func (*Node) UsedMemory

func (n *Node) UsedMemory() int64

Return the sum of memory reserved by containers.

type SwarmCluster

type SwarmCluster struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*SwarmCluster) Container

func (s *SwarmCluster) Container(IdOrName string) *cluster.Container

Container returns the container with IdOrName in the cluster

func (*SwarmCluster) Containers

func (s *SwarmCluster) Containers() []*cluster.Container

Containers returns all the containers in the cluster.

func (*SwarmCluster) CreateContainer

func (s *SwarmCluster) CreateContainer(config *dockerclient.ContainerConfig, name string) (*cluster.Container, error)

Schedule a brand new container into the cluster.

func (*SwarmCluster) Handle

func (s *SwarmCluster) Handle(e *cluster.Event) error

callback for the events

func (*SwarmCluster) Image

func (s *SwarmCluster) Image(IdOrName string) *cluster.Image

Image returns an image with IdOrName in the cluster

func (*SwarmCluster) Images

func (s *SwarmCluster) Images() []*cluster.Image

Containers returns all the images in the cluster.

func (*SwarmCluster) Info

func (s *SwarmCluster) Info() [][2]string

func (*SwarmCluster) RemoveContainer

func (s *SwarmCluster) RemoveContainer(container *cluster.Container, force bool) error

Remove a container from the cluster. Containers should always be destroyed through the scheduler to guarantee atomicity.

Jump to

Keyboard shortcuts

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