@@ -10,22 +10,22 @@ import (
10
10
log "github.com/sirupsen/logrus"
11
11
)
12
12
13
- //AddPod add pod
13
+ // AddPod add pod
14
14
func (c * Calcium ) AddPod (ctx context.Context , podname , favor , desc string ) (* types.Pod , error ) {
15
15
return c .store .AddPod (ctx , podname , favor , desc )
16
16
}
17
17
18
- //AddNode add a node in pod
18
+ // AddNode add a node in pod
19
19
func (c * Calcium ) AddNode (ctx context.Context , nodename , endpoint , podname , ca , cert , key string , cpu int , share , memory int64 , labels map [string ]string ) (* types.Node , error ) {
20
20
return c .store .AddNode (ctx , nodename , endpoint , podname , ca , cert , key , cpu , share , memory , labels )
21
21
}
22
22
23
- //RemovePod remove pod
23
+ // RemovePod remove pod
24
24
func (c * Calcium ) RemovePod (ctx context.Context , podname string ) error {
25
25
return c .store .RemovePod (ctx , podname )
26
26
}
27
27
28
- //RemoveNode remove a node
28
+ // RemoveNode remove a node
29
29
func (c * Calcium ) RemoveNode (ctx context.Context , nodename , podname string ) (* types.Pod , error ) {
30
30
n , err := c .store .GetNode (ctx , podname , nodename )
31
31
if err != nil {
@@ -35,12 +35,12 @@ func (c *Calcium) RemoveNode(ctx context.Context, nodename, podname string) (*ty
35
35
return c .store .GetPod (ctx , podname )
36
36
}
37
37
38
- //ListPods show pods
38
+ // ListPods show pods
39
39
func (c * Calcium ) ListPods (ctx context.Context ) ([]* types.Pod , error ) {
40
40
return c .store .GetAllPods (ctx )
41
41
}
42
42
43
- //ListPodNodes list nodes belong to pod
43
+ // ListPodNodes list nodes belong to pod
44
44
func (c * Calcium ) ListPodNodes (ctx context.Context , podname string , all bool ) ([]* types.Node , error ) {
45
45
var nodes []* types.Node
46
46
candidates , err := c .store .GetNodesByPod (ctx , podname )
@@ -56,32 +56,37 @@ func (c *Calcium) ListPodNodes(ctx context.Context, podname string, all bool) ([
56
56
return nodes , nil
57
57
}
58
58
59
- //ListContainers list containers
59
+ // ListContainers list containers
60
60
func (c * Calcium ) ListContainers (ctx context.Context , appname , entrypoint , nodename string ) ([]* types.Container , error ) {
61
61
return c .store .ListContainers (ctx , appname , entrypoint , nodename )
62
62
}
63
63
64
- //GetPod get one pod
64
+ // ListNodeContainers list containers belong to one node
65
+ func (c * Calcium ) ListNodeContainers (ctx context.Context , nodename string ) ([]* types.Container , error ) {
66
+ return c .store .ListNodeContainers (ctx , nodename )
67
+ }
68
+
69
+ // GetPod get one pod
65
70
func (c * Calcium ) GetPod (ctx context.Context , podname string ) (* types.Pod , error ) {
66
71
return c .store .GetPod (ctx , podname )
67
72
}
68
73
69
- //GetNode get node
74
+ // GetNode get node
70
75
func (c * Calcium ) GetNode (ctx context.Context , podname , nodename string ) (* types.Node , error ) {
71
76
return c .store .GetNode (ctx , podname , nodename )
72
77
}
73
78
74
- //GetContainer get a container
79
+ // GetContainer get a container
75
80
func (c * Calcium ) GetContainer (ctx context.Context , ID string ) (* types.Container , error ) {
76
81
return c .store .GetContainer (ctx , ID )
77
82
}
78
83
79
- //GetContainers get containers
84
+ // GetContainers get containers
80
85
func (c * Calcium ) GetContainers (ctx context.Context , IDs []string ) ([]* types.Container , error ) {
81
86
return c .store .GetContainers (ctx , IDs )
82
87
}
83
88
84
- //SetNodeAvailable set node available or not
89
+ // SetNodeAvailable set node available or not
85
90
func (c * Calcium ) SetNodeAvailable (ctx context.Context , podname , nodename string , available bool ) (* types.Node , error ) {
86
91
n , err := c .store .GetNode (ctx , podname , nodename )
87
92
if err != nil {
@@ -94,12 +99,12 @@ func (c *Calcium) SetNodeAvailable(ctx context.Context, podname, nodename string
94
99
return n , nil
95
100
}
96
101
97
- //GetNodeByName get node by name
102
+ // GetNodeByName get node by name
98
103
func (c * Calcium ) GetNodeByName (ctx context.Context , nodename string ) (* types.Node , error ) {
99
104
return c .store .GetNodeByName (ctx , nodename )
100
105
}
101
106
102
- //ContainerDeployed show container deploy status
107
+ // ContainerDeployed show container deploy status
103
108
func (c * Calcium ) ContainerDeployed (ctx context.Context , ID , appname , entrypoint , nodename , data string ) error {
104
109
return c .store .ContainerDeployed (ctx , ID , appname , entrypoint , nodename , data )
105
110
}
0 commit comments