box

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CGTiming = config.GenFlag[bool]("feature.grader.use_cg_timing", false, "Use --cg-timing flag in grader. Should not be necessary.")

Functions

func New

func New(id int, memQuota int64, logger *zap.SugaredLogger) (eval.Sandbox, error)

New returns a new box instance from the specified ID

func NewStupid

func NewStupid(boxID int, memoryQuota int64, logger *zap.SugaredLogger) (eval.Sandbox, error)

Types

type IsolateBox

type IsolateBox struct {
	// contains filtered or unexported fields
}

IsolateBox is the struct for the current box

func (*IsolateBox) Close

func (b *IsolateBox) Close() error

func (*IsolateBox) FileExists

func (b *IsolateBox) FileExists(fpath string) bool

FileExists returns if a file exists or not

func (*IsolateBox) GetID

func (b *IsolateBox) GetID() int

func (*IsolateBox) MemoryQuota

func (b *IsolateBox) MemoryQuota() int64

func (*IsolateBox) ReadFile

func (b *IsolateBox) ReadFile(fpath string, w io.Writer) error

func (*IsolateBox) RunCommand

func (b *IsolateBox) RunCommand(ctx context.Context, command []string, conf *eval.RunConfig) (*eval.RunStats, error)

func (*IsolateBox) WriteFile

func (b *IsolateBox) WriteFile(fpath string, r io.Reader, mode fs.FileMode) error

WriteFile writes a file to the specified path inside the box

type StupidSandbox

type StupidSandbox struct {
	// contains filtered or unexported fields
}

StupidSandbox can be used for testing. NOTE: should not be used in a proper environment. It has no proper memory limit And time limits are based on manually killing the program

func (*StupidSandbox) Close

func (b *StupidSandbox) Close() error

func (*StupidSandbox) FileExists

func (b *StupidSandbox) FileExists(fpath string) bool

func (*StupidSandbox) GetID

func (b *StupidSandbox) GetID() int

func (*StupidSandbox) MemoryQuota

func (b *StupidSandbox) MemoryQuota() int64

func (*StupidSandbox) ReadFile

func (b *StupidSandbox) ReadFile(fpath string, w io.Writer) error

func (*StupidSandbox) RunCommand

func (b *StupidSandbox) RunCommand(ctx context.Context, command []string, conf *eval.RunConfig) (*eval.RunStats, error)

func (*StupidSandbox) WriteFile

func (b *StupidSandbox) WriteFile(fpath string, r io.Reader, mode fs.FileMode) error

Jump to

Keyboard shortcuts

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