2014-02-25 02:38:24 +00:00
|
|
|
package nsinit
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/dotcloud/docker/pkg/libcontainer"
|
|
|
|
)
|
|
|
|
|
2014-02-25 05:11:52 +00:00
|
|
|
// NsInit is an interface with the public facing methods to provide high level
|
|
|
|
// exec operations on a container
|
2014-02-25 02:38:24 +00:00
|
|
|
type NsInit interface {
|
|
|
|
Exec(container *libcontainer.Container, term Terminal, args []string) (int, error)
|
|
|
|
ExecIn(container *libcontainer.Container, nspid int, args []string) (int, error)
|
|
|
|
Init(container *libcontainer.Container, uncleanRootfs, console string, syncPipe *SyncPipe, args []string) error
|
|
|
|
}
|
|
|
|
|
|
|
|
type linuxNs struct {
|
|
|
|
root string
|
|
|
|
commandFactory CommandFactory
|
|
|
|
stateWriter StateWriter
|
|
|
|
}
|
|
|
|
|
2014-02-25 05:11:52 +00:00
|
|
|
func NewNsInit(command CommandFactory, state StateWriter) NsInit {
|
2014-02-25 02:38:24 +00:00
|
|
|
return &linuxNs{
|
|
|
|
commandFactory: command,
|
|
|
|
stateWriter: state,
|
|
|
|
}
|
|
|
|
}
|