Add Load method to factory

Also update Initialize to take a path to the container
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
This commit is contained in:
Michael Crosby 2014-07-09 16:58:59 -07:00
parent 32221d509b
commit 5001b7e841
1 changed files with 17 additions and 9 deletions

View File

@ -1,17 +1,25 @@
package libcontainer
type Factory interface {
// Initializes a new container with the specified ID and config. The ID is a user-provided
// opaque identifier. Starts an init process with the initialProcess config inside the new
// container.
// Initializes a new container in the given path. A unique ID is generated for the container and
// starts the initial process inside the container.
//
// Returns the new container and the PID of the new init inside the container.
// The caller must reap this PID.
// Returns the new container with a running process.
//
// Errors: ID already exists,
// config or initialConfig is invalid,
// system error.
// Errors:
// Path already exists
// Config or initialConfig is invalid
// System error
//
// On error, any partially created container parts are cleaned up (the operation is atomic).
Initialize(id string, config *Config, initialProcess *ProcessConfig) (*Container, int, error)
Initialize(path string, config *Config) (Container, error)
// Load takes the path for an existing container and reconstructs the container
// from the state.
//
// Errors:
// Path does not exist
// Container is stopped
// System error
Load(path string) (Container, error)
}