This repository was archived by the owner on Feb 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathcluster.go
More file actions
57 lines (42 loc) · 1.57 KB
/
cluster.go
File metadata and controls
57 lines (42 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package cluster
import (
"io"
"github.com/samalba/dockerclient"
)
// Cluster is exported
type Cluster interface {
// Create a container
CreateContainer(config *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, authConfig *dockerclient.AuthConfig, callback func(what, status string))
// Load images
// `callback` can be called multiple time
// `what` is what is being loaded
// `status` is the current status, like "", "in progress" or "loaded"
Load(imageReader io.Reader, 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
// Register an event handler for cluster-wide events.
RegisterEventHandler(h EventHandler) error
// FIXME: remove this method
// Return a random engine
RANDOMENGINE() (*Engine, error)
// RenameContainer rename a container
RenameContainer(container *Container, newName string) error
}