client

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// C return channel to receive works
	C() <-chan Task
}

Client should connect to web service and receive works from web it should sent received work through go channel (have background goroutine(s))

type JudgeResult

type JudgeResult struct {
	SubTasks []SubTaskResult
	Error    string
}

JudgeResult contains final result of current task

type JudgeTask

type JudgeTask struct {
	Type string // defines problem type

	// task parameters
	TimeLimit   time.Duration
	MemoryLimit envexec.Size
	Extra       map[string]interface{} // extra special parameters
}

JudgeTask contains task received from server

type ProgressCompiled

type ProgressCompiled struct {
	Status  ProgressStatus
	Message string // compiler output if failed
}

ProgressCompiled compiled progress

type ProgressProgressed

type ProgressProgressed struct {
	// defines which test case finished
	SubTaskIndex  int
	TestCaseIndex int

	// test case result
	TestCaseResult
}

ProgressProgressed contains progress of current task

type ProgressStatus

type ProgressStatus int

ProgressStatus defines progress status

const (
	ProgressSucceeded ProgressStatus = iota + 1
	ProgressFailed
)

Whether progress success / fail

type SubTaskResult

type SubTaskResult struct {
	Score float64
	Cases []TestCaseResult
}

SubTaskResult contains result for single sub-task

type Task

type Task interface {
	// Param get the judge task
	Param() *JudgeTask

	// Parsed called when problem data have been downloaded and problem
	Parsed(*problem.Config)

	// Compiled called when user code have been compiled (success / fail)
	Compiled(*ProgressCompiled)

	// Progressed called when single test case finished (success / fail + detail message)
	Progressed(*ProgressProgressed)

	// Finished called when all test cases finished / compile failed
	Finished(*JudgeResult)
}

Task contains a single task received from web

type TestCaseResult

type TestCaseResult struct {
	// status
	Status     ProgressStatus
	ExecStatus envexec.Status

	// message
	Message string
	Error   string

	// score
	ScoreRate float64

	// detail stats
	Time   time.Duration
	Memory envexec.Size

	// detail outputs
	Input  []byte
	Answer []byte

	// user stdout / stderr
	UserOutput []byte
	UserError  []byte

	// spj output
	SPJOutput []byte
}

TestCaseResult contains result for single case

Directories

Path Synopsis
Package syzojclient provides interface interact with syzoj front-end.
Package syzojclient provides interface interact with syzoj front-end.

Jump to

Keyboard shortcuts

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