factory.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 filesystem) 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. // System error
  29. Load(id string) (Container, error)
  30. // StartInitialization is an internal API to libcontainer used during the reexec of the
  31. // container.
  32. //
  33. // Errors:
  34. // Pipe connection error
  35. // System error
  36. StartInitialization() error
  37. // Type returns info string about factory type (e.g. lxc, libcontainer...)
  38. Type() string
  39. }