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