judge

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAdapterNames

func GetAdapterNames() []string

func ParallelJudger

func ParallelJudger(ctx context.Context, queue <-chan *RemoteJudgeTask)

func ParallelPoller

func ParallelPoller(ctx context.Context, pollInterval float32, queue chan<- *RemoteJudgeTask)

func Poll

func Poll(ctx context.Context) (bool, error)

func RegisterAdapter

func RegisterAdapter(adapter JudgeAdapter)

Types

type JudgeAdapter

type JudgeAdapter interface {
	Name() string
	Judge(ctx context.Context, task JudgeTask) error
}

func GetAdapter

func GetAdapter(name string) (JudgeAdapter, bool)

type JudgeError

type JudgeError interface {
	error
	Info() *common.SolutionInfo
	Details() *common.SolutionDetails
}

type JudgeTask

type JudgeTask interface {
	Config() common.ProblemConfig
	Env() map[string]string
	ProblemData() string
	SolutionData() string
	Update(ctx context.Context, update *common.SolutionInfo) error
	UploadDetails(ctx context.Context, details *common.SolutionDetails) error
}

type RemoteJudgeTask

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

func (*RemoteJudgeTask) Config

func (t *RemoteJudgeTask) Config() common.ProblemConfig

func (*RemoteJudgeTask) Env

func (t *RemoteJudgeTask) Env() map[string]string

func (*RemoteJudgeTask) ProblemData

func (t *RemoteJudgeTask) ProblemData() string

func (*RemoteJudgeTask) SolutionData

func (t *RemoteJudgeTask) SolutionData() string

func (*RemoteJudgeTask) Update

func (t *RemoteJudgeTask) Update(ctx context.Context, update *common.SolutionInfo) error

func (*RemoteJudgeTask) UploadDetails

func (t *RemoteJudgeTask) UploadDetails(ctx context.Context, details *common.SolutionDetails) error

type SimpleSolutionError

type SimpleSolutionError struct {
	S string
	M string
	D string
}

func (*SimpleSolutionError) Details

func (*SimpleSolutionError) Error

func (e *SimpleSolutionError) Error() string

func (*SimpleSolutionError) Info

Jump to

Keyboard shortcuts

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