box

package
v0.25.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EnsureCGKeeper    = config.GenFlag("feature.grader.ensure_keeper", false, "Ensure isolate-cg-keeper is running")
	IsolateConfigPath = config.GenFlag("feature.grader.isolate_config_path", "/usr/local/etc/isolate", "Configuration path for isolate sandbox")
)
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 InitKeeper added in v0.25.0

func InitKeeper() error

func IsolateVersion added in v0.25.0

func IsolateVersion() string

func New

func New(id int, memQuota int64, logger *slog.Logger) (eval.Sandbox, error)

New returns a new box instance from the specified ID

func NewStupid

func NewStupid(boxID int, memoryQuota int64, logger *slog.Logger) (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) SaveFile added in v0.25.0

func (b *IsolateBox) SaveFile(fpath string, bucket eval.Bucket, filename string, mode fs.FileMode) error

func (*IsolateBox) WriteFile

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

WriteFile writes an eval 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) SaveFile added in v0.25.0

func (b *StupidSandbox) SaveFile(fpath string, bucket eval.Bucket, filename string, mode fs.FileMode) 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