node-api/docker/types.go

59 lines
1.2 KiB
Go

package docker
import (
"path"
"github.com/rosti-cz/apps-api/apps"
)
// Container extends App struct from App
type Container struct {
App apps.App
}
// volumeHostPath each container has one volume mounted into it,
func (c *Container) volumeHostPath() string {
return path.Join("/srv", c.App.Name)
}
// Status returns state of the container
// Possible values: running, stopped, data-only
func (c *Container) Status() (string, error) {
return "", nil
}
// DiskSpace returns number of MB and inodes used by the container in it's mounted volume
func (c *Container) DiskSpace() (int, int, error) {
return du(c.volumeHostPath())
}
// Create creates the container
func (c *Container) Create() error {
return nil
}
// Start starts the container
func (c *Container) Start() error {
return nil
}
// Stop stops the container
func (c *Container) Stop() error {
return nil
}
// Reset restarts the container
func (c *Container) Reset() error {
return nil
}
// Destroy removes the container but keeps the data so it can be created again
func (c *Container) Destroy() error {
return nil
}
// Delete removes both data and the container
func (c *Container) Delete() error {
return nil
}