chore(executor): move struct to meta.go

This commit is contained in:
张泊明518370910136 2025-02-11 10:01:53 -05:00
parent 49b7c7c5db
commit 7254c48f9a
GPG Key ID: D47306D7062CDA9D
6 changed files with 11 additions and 10 deletions

View File

@ -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 {

View File

@ -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{})
} }

View File

@ -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,

View File

@ -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{})
} }

View File

@ -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 {

View File

@ -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",