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:
@@ -37,7 +37,7 @@ var idRegex = regexp.MustCompile(`^[\w+-\.]+$`)
|
||||
// The id must not be empty and consist of only the following characters:
|
||||
// ASCII letters, digits, underscore, plus, minus, period. The id must be
|
||||
// unique and non-existent for the given root path.
|
||||
func Create(root, id string, config *configs.Config) (Container, error) {
|
||||
func Create(root, id string, config *configs.Config) (*Container, error) {
|
||||
if root == "" {
|
||||
return nil, errors.New("root not set")
|
||||
}
|
||||
@@ -98,7 +98,7 @@ func Create(root, id string, config *configs.Config) (Container, error) {
|
||||
if err := os.Mkdir(containerRoot, 0o711); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c := &linuxContainer{
|
||||
c := &Container{
|
||||
id: id,
|
||||
root: containerRoot,
|
||||
config: config,
|
||||
@@ -112,7 +112,7 @@ func Create(root, id string, config *configs.Config) (Container, error) {
|
||||
// Load takes a path to the state directory (root) and an id of an existing
|
||||
// container, and returns a Container object reconstructed from the saved
|
||||
// state. This presents a read only view of the container.
|
||||
func Load(root, id string) (Container, error) {
|
||||
func Load(root, id string) (*Container, error) {
|
||||
if root == "" {
|
||||
return nil, errors.New("root not set")
|
||||
}
|
||||
@@ -137,7 +137,7 @@ func Load(root, id string) (Container, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c := &linuxContainer{
|
||||
c := &Container{
|
||||
initProcess: r,
|
||||
initProcessStartTime: state.InitProcessStartTime,
|
||||
id: id,
|
||||
|
||||
Reference in New Issue
Block a user