2014-07-09 05:42:57 +08:00
|
|
|
package libcontainer
|
|
|
|
|
2014-12-17 17:12:23 +08:00
|
|
|
import (
|
2015-06-22 10:29:59 +08:00
|
|
|
"github.com/opencontainers/runc/libcontainer/configs"
|
2014-12-17 17:12:23 +08:00
|
|
|
)
|
|
|
|
|
2014-07-09 05:42:57 +08:00
|
|
|
type Factory interface {
|
2014-09-01 15:32:01 +08:00
|
|
|
// Creates a new container with the given id and starts the initial process inside it.
|
|
|
|
// id must be a string containing only letters, digits and underscores and must contain
|
|
|
|
// between 1 and 1024 characters, inclusive.
|
|
|
|
//
|
|
|
|
// The id must not already be in use by an existing container. Containers created using
|
|
|
|
// a factory with the same path (and file system) must have distinct ids.
|
2014-07-09 05:42:57 +08:00
|
|
|
//
|
2014-07-10 07:58:59 +08:00
|
|
|
// Returns the new container with a running process.
|
2014-07-09 05:42:57 +08:00
|
|
|
//
|
2014-10-23 07:27:06 +08:00
|
|
|
// errors:
|
2014-09-04 07:03:41 +08:00
|
|
|
// IdInUse - id is already in use by a container
|
|
|
|
// InvalidIdFormat - id has incorrect format
|
|
|
|
// ConfigInvalid - config is invalid
|
2014-10-23 07:27:06 +08:00
|
|
|
// Systemerror - System error
|
2014-07-09 05:42:57 +08:00
|
|
|
//
|
|
|
|
// On error, any partially created container parts are cleaned up (the operation is atomic).
|
2014-12-17 17:12:23 +08:00
|
|
|
Create(id string, config *configs.Config) (Container, error)
|
2014-07-10 07:58:59 +08:00
|
|
|
|
2014-10-23 01:35:29 +08:00
|
|
|
// Load takes an ID for an existing container and returns the container information
|
|
|
|
// from the state. This presents a read only view of the container.
|
2014-07-10 07:58:59 +08:00
|
|
|
//
|
2014-10-23 07:27:06 +08:00
|
|
|
// errors:
|
2014-07-10 07:58:59 +08:00
|
|
|
// Path does not exist
|
|
|
|
// Container is stopped
|
|
|
|
// System error
|
2014-10-28 08:51:14 +08:00
|
|
|
Load(id string) (Container, error)
|
2014-12-15 23:00:57 +08:00
|
|
|
|
2015-04-13 05:26:22 +08:00
|
|
|
// StartInitialization is an internal API to libcontainer used during the reexec of the
|
2015-04-09 05:14:51 +08:00
|
|
|
// container.
|
2014-12-15 23:05:11 +08:00
|
|
|
//
|
|
|
|
// Errors:
|
2015-04-09 05:14:51 +08:00
|
|
|
// Pipe connection error
|
|
|
|
// System error
|
|
|
|
StartInitialization() error
|
2015-03-12 02:44:56 +08:00
|
|
|
|
|
|
|
// Type returns info string about factory type (e.g. lxc, libcontainer...)
|
|
|
|
Type() string
|
2014-07-09 05:42:57 +08:00
|
|
|
}
|