sandbox

package
v0.0.0-...-47ff751 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2016 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Libraries related to the worker of moolinet It will compile, analyse 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
}

func NewDockerSandbox

func NewDockerSandbox(image string) (*DockerSandbox, error)

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()

func (*DockerSandbox) GetLogs

func (s *DockerSandbox) GetLogs() string

func (*DockerSandbox) Run

func (s *DockerSandbox) Run(command []string, timeout int, connection bool) (string, error)

TODO: Add connection support

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, timeout int, connection bool) (string, error)

	// Get logs linked to the Sandbox
	// Useful for debugging
	GetLogs() string
}

The sandbox interface which enable you to run your program indepandtly 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL