Skip to content

Commit 86d6898

Browse files
authored
Merge pull request opencontainers#3375 from kolyshkin/rm-container-iface
libct: rm BaseContainer and Container interfaces
2 parents cae8228 + 102b8ab commit 86d6898

File tree

12 files changed

+128
-194
lines changed

12 files changed

+128
-194
lines changed

delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"golang.org/x/sys/unix"
1414
)
1515

16-
func killContainer(container libcontainer.Container) error {
16+
func killContainer(container *libcontainer.Container) error {
1717
_ = container.Signal(unix.SIGKILL, false)
1818
for i := 0; i < 100; i++ {
1919
time.Sleep(100 * time.Millisecond)

libcontainer/container.go

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
package libcontainer
66

77
import (
8-
"os"
98
"time"
109

1110
"github.com/opencontainers/runc/libcontainer/configs"
12-
"github.com/opencontainers/runtime-spec/specs-go"
1311
)
1412

1513
// Status is the status of a container.
@@ -59,68 +57,3 @@ type BaseState struct {
5957
// Config is the container's configuration.
6058
Config configs.Config `json:"config"`
6159
}
62-
63-
// BaseContainer is a libcontainer container object.
64-
//
65-
// Each container is thread-safe within the same process. Since a container can
66-
// be destroyed by a separate process, any function may return that the container
67-
// was not found. BaseContainer includes methods that are platform agnostic.
68-
type BaseContainer interface {
69-
// Returns the ID of the container
70-
ID() string
71-
72-
// Returns the current status of the container.
73-
Status() (Status, error)
74-
75-
// State returns the current container's state information.
76-
State() (*State, error)
77-
78-
// OCIState returns the current container's state information.
79-
OCIState() (*specs.State, error)
80-
81-
// Returns the current config of the container.
82-
Config() configs.Config
83-
84-
// Returns the PIDs inside this container. The PIDs are in the namespace of the calling process.
85-
//
86-
// Some of the returned PIDs may no longer refer to processes in the Container, unless
87-
// the Container state is PAUSED in which case every PID in the slice is valid.
88-
Processes() ([]int, error)
89-
90-
// Returns statistics for the container.
91-
Stats() (*Stats, error)
92-
93-
// Set resources of container as configured
94-
//
95-
// We can use this to change resources when containers are running.
96-
//
97-
Set(config configs.Config) error
98-
99-
// Start a process inside the container. Returns error if process fails to
100-
// start. You can track process lifecycle with passed Process structure.
101-
Start(process *Process) (err error)
102-
103-
// Run immediately starts the process inside the container. Returns error if process
104-
// fails to start. It does not block waiting for the exec fifo after start returns but
105-
// opens the fifo after start returns.
106-
Run(process *Process) (err error)
107-
108-
// Destroys the container, if its in a valid state, after killing any
109-
// remaining running processes.
110-
//
111-
// Any event registrations are removed before the container is destroyed.
112-
// No error is returned if the container is already destroyed.
113-
//
114-
// Running containers must first be stopped using Signal(..).
115-
// Paused containers must first be resumed using Resume(..).
116-
Destroy() error
117-
118-
// Signal sends the provided signal code to the container's initial process.
119-
//
120-
// If all is specified the signal is sent to all processes in the container
121-
// including the initial process.
122-
Signal(s os.Signal, all bool) error
123-
124-
// Exec signals the container to exec the users process at the end of the init.
125-
Exec() error
126-
}

0 commit comments

Comments
 (0)