mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
libct: rm BaseContainer and Container interfaces
The only implementation of these is linuxContainer. It does not make sense to have an interface with a single implementation, and we do not foresee other types of containers being added to runc. Remove BaseContainer and Container interfaces, moving their methods documentation to linuxContainer. Rename linuxContainer to Container. Adopt users from using interface to using struct. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
+4
-4
@@ -25,7 +25,7 @@ var errEmptyID = errors.New("container id cannot be empty")
|
||||
|
||||
// getContainer returns the specified container instance by loading it from
|
||||
// a state directory (root).
|
||||
func getContainer(context *cli.Context) (libcontainer.Container, error) {
|
||||
func getContainer(context *cli.Context) (*libcontainer.Container, error) {
|
||||
id := context.Args().First()
|
||||
if id == "" {
|
||||
return nil, errEmptyID
|
||||
@@ -82,7 +82,7 @@ func newProcess(p specs.Process) (*libcontainer.Process, error) {
|
||||
return lp, nil
|
||||
}
|
||||
|
||||
func destroy(container libcontainer.Container) {
|
||||
func destroy(container *libcontainer.Container) {
|
||||
if err := container.Destroy(); err != nil {
|
||||
logrus.Error(err)
|
||||
}
|
||||
@@ -162,7 +162,7 @@ func createPidFile(path string, process *libcontainer.Process) error {
|
||||
return os.Rename(tmpName, path)
|
||||
}
|
||||
|
||||
func createContainer(context *cli.Context, id string, spec *specs.Spec) (libcontainer.Container, error) {
|
||||
func createContainer(context *cli.Context, id string, spec *specs.Spec) (*libcontainer.Container, error) {
|
||||
rootlessCg, err := shouldUseRootlessCgroupManager(context)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -193,7 +193,7 @@ type runner struct {
|
||||
preserveFDs int
|
||||
pidFile string
|
||||
consoleSocket string
|
||||
container libcontainer.Container
|
||||
container *libcontainer.Container
|
||||
action CtAct
|
||||
notifySocket *notifySocket
|
||||
criuOpts *libcontainer.CriuOpts
|
||||
|
||||
Reference in New Issue
Block a user