judger

package module
v0.0.0-...-20515da Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusOK = "OK"
)

Variables

View Source
var (
	CallbackWaitGroup sync.WaitGroup

	OnJudgeResponse []JudgeResponseCallback
)
View Source
var (
	MachineContext           context.Context
	MachineContextCancelFunc context.CancelFunc
)
View Source
var (
	MachineWaitGroup sync.WaitGroup
)

Functions

func CallbackAllError

func CallbackAllError(status string, sid uint32, isContest bool, datasetCount int)

func CallbackSuccess

func CallbackSuccess(sid uint32, isContest bool, resultList []*protobuf.JudgeCaseResult)

func Compiler

func Compiler(sid uint32, codePath string, code []byte, compileInfo *JudgerModels.CompileInfo) ([]byte, error)

func InitJudger

func InitJudger(ctx context.Context, config *JudgerModels.JudgerConfigType, storageGetFunc StorageGetFuncType, withDocker bool, withKafka bool, role string)

func JudgeOneCase

func JudgeOneCase(testResult *JudgerModels.TestResult, stdout, rightStdout, compMode string) *JudgerModels.JudgeResult

func JudgeRequestBridge

func JudgeRequestBridge(body []byte)

func JudgeRequestHandler

func JudgeRequestHandler()

func JudgeResponseBridge

func JudgeResponseBridge(body []byte)

func JudgeResultHandler

func JudgeResultHandler()

func Language

func Language()

func MQ

func MQ(ctx context.Context)

func Requeue

func Requeue(topic string, body []byte)

func Runner

func Runner(
	sid uint32, codePath string,
	compileInfo *JudgerModels.CompileInfo,
	testCases []*JudgerModels.TestCaseType,
	timeLimit, spaceLimit, outputPath string,
	code []byte, buildProduction []byte,
) (map[string][]byte, error)

func Scheduler

func Scheduler(request *protobuf.JudgeRequest) (string, []*protobuf.JudgeCaseResult, error)

func StartMachine

func StartMachine(ctx context.Context, index uint, queueChan chan []byte)

func Starter

func Starter(info *StarterType) error

Types

type CollectedStdout

type CollectedStdout struct {
	Stdout      string
	RightStdout string
}

type JudgeResponseCallback

type JudgeResponseCallback = func(sid uint32, isContest bool, judgeResult []*JudgerModels.JudgeResult)

type StarterType

type StarterType struct {
	Code       []byte
	IsContest  bool
	Sid        uint32
	Tid        uint32
	Version    uint32
	Language   string
	TimeLimit  uint32
	SpaceLimit uint32
	CompMode   string
}

type StorageGetFuncType

type StorageGetFuncType = func(tid uint32, version string) ([]*JudgerModels.TestCaseType, error)
var (
	StorageGetFunc StorageGetFuncType
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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