chore(executor): move struct to meta.go
This commit is contained in:
parent
49b7c7c5db
commit
7254c48f9a
|
@ -5,8 +5,6 @@ import (
|
||||||
"github.com/joint-online-judge/JOJ3/internal/stage"
|
"github.com/joint-online-judge/JOJ3/internal/stage"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Dummy struct{}
|
|
||||||
|
|
||||||
func (e *Dummy) Run(cmds []stage.Cmd) ([]stage.ExecutorResult, error) {
|
func (e *Dummy) Run(cmds []stage.Cmd) ([]stage.ExecutorResult, error) {
|
||||||
var res []stage.ExecutorResult
|
var res []stage.ExecutorResult
|
||||||
for range cmds {
|
for range cmds {
|
||||||
|
|
|
@ -4,6 +4,8 @@ import "github.com/joint-online-judge/JOJ3/internal/stage"
|
||||||
|
|
||||||
var name = "dummy"
|
var name = "dummy"
|
||||||
|
|
||||||
|
type Dummy struct{}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
stage.RegisterExecutor(name, &Dummy{})
|
stage.RegisterExecutor(name, &Dummy{})
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,6 @@ import (
|
||||||
"github.com/joint-online-judge/JOJ3/internal/stage"
|
"github.com/joint-online-judge/JOJ3/internal/stage"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Local struct{}
|
|
||||||
|
|
||||||
func generateResult(
|
func generateResult(
|
||||||
err error,
|
err error,
|
||||||
processState *os.ProcessState,
|
processState *os.ProcessState,
|
||||||
|
|
|
@ -4,6 +4,8 @@ import "github.com/joint-online-judge/JOJ3/internal/stage"
|
||||||
|
|
||||||
var name = "local"
|
var name = "local"
|
||||||
|
|
||||||
|
type Local struct{}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
stage.RegisterExecutor(name, &Local{})
|
stage.RegisterExecutor(name, &Local{})
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,6 @@ import (
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Sandbox struct {
|
|
||||||
execServer, token string
|
|
||||||
cachedMap map[string]string
|
|
||||||
execClient pb.ExecutorClient
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *Sandbox) Run(cmds []stage.Cmd) ([]stage.ExecutorResult, error) {
|
func (e *Sandbox) Run(cmds []stage.Cmd) ([]stage.ExecutorResult, error) {
|
||||||
var err error
|
var err error
|
||||||
if e.execClient == nil {
|
if e.execClient == nil {
|
||||||
|
|
|
@ -1,11 +1,18 @@
|
||||||
package sandbox
|
package sandbox
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/criyle/go-judge/pb"
|
||||||
"github.com/joint-online-judge/JOJ3/internal/stage"
|
"github.com/joint-online-judge/JOJ3/internal/stage"
|
||||||
)
|
)
|
||||||
|
|
||||||
var name = "sandbox"
|
var name = "sandbox"
|
||||||
|
|
||||||
|
type Sandbox struct {
|
||||||
|
execServer, token string
|
||||||
|
cachedMap map[string]string
|
||||||
|
execClient pb.ExecutorClient
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
stage.RegisterExecutor(name, &Sandbox{
|
stage.RegisterExecutor(name, &Sandbox{
|
||||||
execServer: "localhost:5051",
|
execServer: "localhost:5051",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user