Documentation ¶
Index ¶
- Variables
- type Cluster
- func (c *Cluster) AddNode(n *Node) error
- func (c *Cluster) Container(IdOrName string) *Container
- func (c *Cluster) Containers() []*Container
- func (c *Cluster) DeployContainer(node *Node, config *dockerclient.ContainerConfig, name string) (*Container, error)
- func (c *Cluster) DestroyContainer(container *Container, force bool) error
- func (c *Cluster) Events(h EventHandler) error
- func (c *Cluster) Handle(e *Event) error
- func (c *Cluster) Node(addr string) *Node
- func (c *Cluster) Nodes() []*Node
- func (c *Cluster) UpdateNodes(nodes []*discovery.Node)
- type Container
- type Event
- type EventHandler
- type Node
- func (n *Node) AddContainer(container *Container) error
- func (n *Node) AddImage(image *dockerclient.Image)
- func (n *Node) CleanupContainers()
- func (n *Node) Connect(config *tls.Config) error
- func (n *Node) Containers() []*Container
- func (n *Node) Create(config *dockerclient.ContainerConfig, name string, pullImage bool) (*Container, error)
- func (n *Node) Destroy(container *Container, force bool) error
- func (n *Node) Events(h EventHandler) error
- func (n *Node) Image(IdOrName string) *dockerclient.Image
- func (n *Node) Images() []*dockerclient.Image
- func (n *Node) IsConnected() bool
- func (n *Node) IsHealthy() bool
- func (n *Node) Pull(image string) error
- func (n *Node) RefreshContainer(ID string, full bool) error
- func (n *Node) RefreshContainers(full bool) error
- func (n *Node) RefreshContainersAsync()
- func (n *Node) RemoveContainer(container *Container) error
- func (n *Node) ReservedCpus() int64
- func (n *Node) ReservedMemory() int64
- func (n *Node) String() string
- func (n *Node) UsableCpus() int64
- func (n *Node) UsableMemory() int64
Constants ¶
This section is empty.
Variables ¶
var ( ErrNodeNotConnected = errors.New("node is not connected to docker's REST API") ErrNodeAlreadyRegistered = errors.New("node was already added to the cluster") )
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
func NewCluster ¶
func (*Cluster) AddNode ¶
Register a node within the cluster. The node must have been already initialized.
func (*Cluster) Containers ¶
Containers returns all the containers in the cluster.
func (*Cluster) DeployContainer ¶
func (c *Cluster) DeployContainer(node *Node, config *dockerclient.ContainerConfig, name string) (*Container, error)
Deploy a container into a `specific` node on the cluster.
func (*Cluster) DestroyContainer ¶
Destroys a given `container` from the cluster.
func (*Cluster) Events ¶
func (c *Cluster) Events(h EventHandler) error
func (*Cluster) UpdateNodes ¶
type Container ¶
type Container struct { dockerclient.Container Info dockerclient.ContainerInfo Node *Node }
type Event ¶
type Event struct { dockerclient.Event Node *Node }
type EventHandler ¶
type Node ¶
type Node struct { sync.RWMutex ID string IP string Addr string Name string Cpus int64 Memory int64 Labels map[string]string // contains filtered or unexported fields }
func (*Node) AddContainer ¶
Inject a container into the internal state.
func (*Node) AddImage ¶
func (n *Node) AddImage(image *dockerclient.Image)
Inject an image into the internal state.
func (*Node) CleanupContainers ¶
func (n *Node) CleanupContainers()
Wipes the internal container state.
func (*Node) Connect ¶
Connect will initialize a connection to the Docker daemon running on the host, gather machine specs (memory, cpu, ...) and monitor state changes.
func (*Node) Containers ¶
func (*Node) Create ¶
func (n *Node) Create(config *dockerclient.ContainerConfig, name string, pullImage bool) (*Container, error)
func (*Node) Image ¶
func (n *Node) Image(IdOrName string) *dockerclient.Image
Image returns the image with IdOrName in the node
func (*Node) Images ¶
func (n *Node) Images() []*dockerclient.Image
func (*Node) IsConnected ¶
IsConnected returns true if the engine is connected to a remote docker API
func (*Node) RefreshContainer ¶
Refresh the status of a container running on the node. If `full` is true, the container will be inspected.
func (*Node) RefreshContainers ¶
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 ¶
Remove a container from the internal test.
func (*Node) ReservedCpus ¶
Return the sum of CPUs reserved by containers.
func (*Node) ReservedMemory ¶
Return the sum of memory reserved by containers.