go-judge/runner/queue.go
criyle 1f86f25995 Refactor & Documentation
- pkg/runner -> pkg/envexec
- add idea about executor server
2020-03-03 02:32:59 -05:00

29 lines
721 B
Go

package runner
// Sender interface is used to send run task into message queue
type Sender interface {
// Send used to initial a RPC call and receive result from channel
Send(RunTask) (<-chan RunTaskResult, error)
}
// Receiver interface is used to receive run task from message queue
type Receiver interface {
// ReceiveC get the channel to receive tasks
ReceiveC() <-chan Task
}
// Queue provides asynchronous message queue for run tasks
type Queue interface {
Sender
Receiver
}
// Task represent a single task to run
type Task interface {
// Task gets the run task parameter
Task() *RunTask
// Done returns the run task result for the run task (should be called only once at end)
Done(*RunTaskResult)
}