-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontainer.go
40 lines (33 loc) · 916 Bytes
/
container.go
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
package libcontainerd
import (
"fmt"
"time"
"github.com/docker/docker/restartmanager"
)
const (
// InitFriendlyName is the name given in the lookup map of processes
// for the first process started in a container.
InitFriendlyName = "init"
configFilename = "config.json"
)
type containerCommon struct {
process
restartManager restartmanager.RestartManager
restarting bool
processes map[string]*process
startedAt time.Time
}
// WithRestartManager sets the restartmanager to be used with the container.
func WithRestartManager(rm restartmanager.RestartManager) CreateOption {
return restartManager{rm}
}
type restartManager struct {
rm restartmanager.RestartManager
}
func (rm restartManager) Apply(p interface{}) error {
if pr, ok := p.(*container); ok {
pr.restartManager = rm.rm
return nil
}
return fmt.Errorf("WithRestartManager option not supported for this client")
}