2017-08-11 16:42:25 +00:00
|
|
|
package ctr
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2017-08-17 14:43:02 +00:00
|
|
|
|
|
|
|
"github.com/containers/storage"
|
2017-08-11 16:42:25 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
// ErrNotImplemented indicates that functionality is not yet implemented
|
|
|
|
ErrNotImplemented = fmt.Errorf("NOT IMPLEMENTED")
|
|
|
|
)
|
|
|
|
|
|
|
|
// Container is a single OCI container
|
|
|
|
type Container struct {
|
|
|
|
// TODO populate
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create creates a container in the OCI runtime
|
|
|
|
func (c *Container) Create() error {
|
|
|
|
return ErrNotImplemented
|
|
|
|
}
|
|
|
|
|
|
|
|
// Start starts a container
|
|
|
|
func (c *Container) Start() error {
|
|
|
|
return ErrNotImplemented
|
|
|
|
}
|
|
|
|
|
|
|
|
// Stop stops a container
|
|
|
|
func (c *Container) Stop() error {
|
|
|
|
return ErrNotImplemented
|
|
|
|
}
|
|
|
|
|
|
|
|
// Kill sends a signal to a container
|
|
|
|
func (c *Container) Kill(signal uint) error {
|
|
|
|
return ErrNotImplemented
|
|
|
|
}
|
|
|
|
|
|
|
|
// Exec starts a new process inside the container
|
2017-08-15 18:33:40 +00:00
|
|
|
// Returns fully qualified URL of streaming server for executed process
|
|
|
|
func (c *Container) Exec(cmd []string, tty bool, stdin bool) (string, error) {
|
|
|
|
return "", ErrNotImplemented
|
2017-08-11 16:42:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Attach attaches to a container
|
2017-08-15 18:33:40 +00:00
|
|
|
// Returns fully qualified URL of streaming server for the container
|
|
|
|
func (c *Container) Attach(stdin, tty bool) (string, error) {
|
|
|
|
return "", ErrNotImplemented
|
2017-08-11 16:42:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Mount mounts a container's filesystem on the host
|
|
|
|
// The path where the container has been mounted is returned
|
|
|
|
func (c *Container) Mount() (string, error) {
|
|
|
|
return "", ErrNotImplemented
|
|
|
|
}
|
|
|
|
|
|
|
|
// Status gets a container's status
|
|
|
|
// TODO this should return relevant information about container state
|
|
|
|
func (c *Container) Status() error {
|
|
|
|
return ErrNotImplemented
|
|
|
|
}
|
2017-08-17 14:43:02 +00:00
|
|
|
|
|
|
|
// Export exports a container's root filesystem as a tar archive
|
|
|
|
// The archive will be saved as a file at the given path
|
|
|
|
func (c *Container) Export(path string) error {
|
|
|
|
return ErrNotImplemented
|
|
|
|
}
|
|
|
|
|
|
|
|
// Commit commits the changes between a container and its image, creating a new
|
|
|
|
// image
|
|
|
|
// If the container was not created from an image (for example,
|
|
|
|
// WithRootFSFromPath will create a container from a directory on the system),
|
|
|
|
// a new base image will be created from the contents of the container's
|
|
|
|
// filesystem
|
|
|
|
func (c *Container) Commit() (*storage.Image, error) {
|
|
|
|
return nil, ErrNotImplemented
|
|
|
|
}
|