Documentation
¶
Overview ¶
Package sandbox contains code related to the worker of moolinet. It will compile, analyze and execute the code in a sandbox.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DockerSandbox ¶
type DockerSandbox struct {
// contains filtered or unexported fields
}
DockerSandbox is the Docker implementation of the Sandbox interface.
func NewDockerSandbox ¶
func NewDockerSandbox(c DockerSandboxConfig) (*DockerSandbox, error)
NewDockerSandbox returns a new DockerSandbox from an image name.
We should use a design pattern such as Fabric or Builder, or somethng similar In order to split the creation logic and the command logic. BUG(#2) We should not try to download the image every time we start a new container. We should check if it exists locally.
func (*DockerSandbox) Destroy ¶
func (s *DockerSandbox) Destroy()
Destroy removes the current container.
func (*DockerSandbox) GetLogs ¶
func (s *DockerSandbox) GetLogs() string
GetLogs returns currently saved logs.
type DockerSandboxConfig ¶
type DockerSandboxConfig struct {
Image string
Memory int64
Disk int64 //@FIXME deprecated
Procs int64
}
DockerSandboxConfig contains parameters related to the initialization of a Docker Sandbox.
type Sandbox ¶
type Sandbox interface {
// Destroy the sandbox on the main system.
// Usually just after its creation with defer.
Destroy()
// Run a command in the sandbox and get its outputs
// (output, error)
Run(command []string, config Config) (string, error)
// Get logs linked to the Sandbox
// Useful for debugging
GetLogs() string
}
Sandbox is the interface which enable you to run your program independently of the implementation of the sandbox.
Notes ¶
Bugs ¶
We should not try to download the image every time we start a new container. We should check if it exists locally.
Logs are not checked for error when pulling an image