factory.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package libcontainer
  2. import (
  3. "github.com/opencontainers/runc/libcontainer/configs"
  4. )
  5. type Factory interface {
  6. // Creates a new container with the given id and starts the initial process inside it.
  7. // id must be a string containing only letters, digits and underscores and must contain
  8. // between 1 and 1024 characters, inclusive.
  9. //
  10. // The id must not already be in use by an existing container. Containers created using
  11. // a factory with the same path (and file system) must have distinct ids.
  12. //
  13. // Returns the new container with a running process.
  14. //
  15. // errors:
  16. // IdInUse - id is already in use by a container
  17. // InvalidIdFormat - id has incorrect format
  18. // ConfigInvalid - config is invalid
  19. // Systemerror - System error
  20. //
  21. // On error, any partially created container parts are cleaned up (the operation is atomic).
  22. Create(id string, config *configs.Config) (Container, error)
  23. // Load takes an ID for an existing container and returns the container information
  24. // from the state. This presents a read only view of the container.
  25. //
  26. // errors:
  27. // Path does not exist
  28. // Container is stopped
  29. // System error
  30. Load(id string) (Container, error)
  31. // StartInitialization is an internal API to libcontainer used during the reexec of the
  32. // container.
  33. //
  34. // Errors:
  35. // Pipe connection error
  36. // System error
  37. StartInitialization() error
  38. // Type returns info string about factory type (e.g. lxc, libcontainer...)
  39. Type() string
  40. }