chore(pb): migrate step 1 with hybrid API

This commit is contained in:
criyle 2025-08-14 03:06:33 +00:00
parent 6582aaea4f
commit 51423d7110
24 changed files with 4776 additions and 360 deletions

View File

@ -66,9 +66,9 @@ func (p *execProxy) FileGet(c *gin.Context) {
return
}
fid := &pb.FileID{
fid := pb.FileID_builder{
FileID: uri.FileID,
}
}.Build()
rep, err := p.client.FileGet(c, fid)
if err != nil {
c.AbortWithError(http.StatusInternalServerError, err)
@ -95,10 +95,10 @@ func (p *execProxy) FilePost(c *gin.Context) {
return
}
req := &pb.FileContent{
req := pb.FileContent_builder{
Name: fh.Filename,
Content: b,
}
}.Build()
rep, err := p.client.FileAdd(c, req)
if err != nil {
c.AbortWithError(http.StatusInternalServerError, err)
@ -117,9 +117,9 @@ func (p *execProxy) FileDelete(c *gin.Context) {
return
}
fid := &pb.FileID{
fid := pb.FileID_builder{
FileID: uri.FileID,
}
}.Build()
rep, err := p.client.FileDelete(c, fid)
if err != nil {
c.AbortWithError(http.StatusInternalServerError, err)

View File

@ -13,6 +13,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/protobuf/types/known/emptypb"
)
var _ Stream = &grpcWrapper{}
@ -45,22 +46,22 @@ func (w *grpcWrapper) Send(req *stream.Request) error {
case req.Request != nil:
w.sc.Send(convertPBRequest(req.Request))
case req.Input != nil:
w.sc.Send(&pb.StreamRequest{Request: &pb.StreamRequest_ExecInput{ExecInput: &pb.StreamRequest_Input{
w.sc.Send(pb.StreamRequest_builder{ExecInput: pb.StreamRequest_Input_builder{
Index: uint32(req.Input.Index),
Fd: uint32(req.Input.Fd),
Content: req.Input.Content,
}}})
}.Build()}.Build())
case req.Resize != nil:
w.sc.Send(&pb.StreamRequest{Request: &pb.StreamRequest_ExecResize{ExecResize: &pb.StreamRequest_Resize{
w.sc.Send(pb.StreamRequest_builder{ExecResize: pb.StreamRequest_Resize_builder{
Index: uint32(req.Resize.Index),
Fd: uint32(req.Resize.Fd),
Rows: uint32(req.Resize.Rows),
Cols: uint32(req.Resize.Cols),
X: uint32(req.Resize.X),
Y: uint32(req.Resize.Y),
}}})
}.Build()}.Build())
case req.Cancel != nil:
w.sc.Send(&pb.StreamRequest{Request: &pb.StreamRequest_ExecCancel{}})
w.sc.Send(pb.StreamRequest_builder{ExecCancel: &emptypb.Empty{}}.Build())
default:
return errors.New("send: unknown operation")
}
@ -72,18 +73,18 @@ func (w *grpcWrapper) Recv() (*stream.Response, error) {
if err != nil {
return nil, err
}
switch i := resp.Response.(type) {
case *pb.StreamResponse_ExecOutput:
switch resp.WhichResponse() {
case pb.StreamResponse_ExecOutput_case:
return &stream.Response{Output: &stream.OutputResponse{
Index: int(i.ExecOutput.Index),
Fd: int(i.ExecOutput.Fd),
Content: i.ExecOutput.Content,
Index: int(resp.GetExecOutput().GetIndex()),
Fd: int(resp.GetExecOutput().GetFd()),
Content: resp.GetExecOutput().GetContent(),
}}, nil
case *pb.StreamResponse_ExecResponse:
case pb.StreamResponse_ExecResponse_case:
return &stream.Response{Response: &model.Response{
RequestID: i.ExecResponse.RequestID,
Results: convertPBResult(i.ExecResponse.Results),
ErrorMsg: i.ExecResponse.Error,
RequestID: resp.GetExecResponse().GetRequestID(),
Results: convertPBResult(resp.GetExecResponse().GetResults()),
ErrorMsg: resp.GetExecResponse().GetError(),
}}, nil
}
return nil, errors.New("recv: invalid response")
@ -93,16 +94,16 @@ func convertPBResult(res []*pb.Response_Result) []model.Result {
var ret []model.Result
for _, r := range res {
ret = append(ret, model.Result{
Status: model.Status(r.Status),
ExitStatus: int(r.ExitStatus),
Error: r.Error,
Time: r.Time,
RunTime: r.RunTime,
Memory: r.Memory,
Files: convertFiles(r.Files),
Buffs: r.Files,
FileIDs: r.FileIDs,
FileError: convertPBFileError(r.FileError),
Status: model.Status(r.GetStatus()),
ExitStatus: int(r.GetExitStatus()),
Error: r.GetError(),
Time: r.GetTime(),
RunTime: r.GetRunTime(),
Memory: r.GetMemory(),
Files: convertFiles(r.GetFiles()),
Buffs: r.GetFiles(),
FileIDs: r.GetFileIDs(),
FileError: convertPBFileError(r.GetFileError()),
})
}
return ret
@ -117,15 +118,13 @@ func convertFiles(buf map[string][]byte) map[string]string {
}
func convertPBRequest(req *model.Request) *pb.StreamRequest {
ret := &pb.StreamRequest{
Request: &pb.StreamRequest_ExecRequest{
ExecRequest: &pb.Request{
RequestID: req.RequestID,
Cmd: convertPBCmd(req.Cmd),
PipeMapping: convertPBPipeMapping(req.PipeMapping),
},
},
}
ret := pb.StreamRequest_builder{
ExecRequest: pb.Request_builder{
RequestID: req.RequestID,
Cmd: convertPBCmd(req.Cmd),
PipeMapping: convertPBPipeMapping(req.PipeMapping),
}.Build(),
}.Build()
return ret
}
@ -133,9 +132,9 @@ func convertPBFileError(fe []*pb.Response_FileError) []model.FileError {
var ret []model.FileError
for _, v := range fe {
ret = append(ret, model.FileError{
Name: v.Name,
Type: model.FileErrorType(v.Type),
Message: v.Message,
Name: v.GetName(),
Type: model.FileErrorType(v.GetType()),
Message: v.GetMessage(),
})
}
return ret
@ -144,7 +143,7 @@ func convertPBFileError(fe []*pb.Response_FileError) []model.FileError {
func convertPBCmd(cmd []model.Cmd) []*pb.Request_CmdType {
var ret []*pb.Request_CmdType
for _, c := range cmd {
ret = append(ret, &pb.Request_CmdType{
ret = append(ret, pb.Request_CmdType_builder{
Args: c.Args,
Env: c.Env,
Tty: c.TTY,
@ -164,7 +163,7 @@ func convertPBCmd(cmd []model.Cmd) []*pb.Request_CmdType {
CopyOutMax: c.CopyOutMax,
CopyOutDir: c.CopyOutDir,
Symlinks: convertSymlink(c.CopyIn),
})
}.Build())
}
return ret
}
@ -188,10 +187,10 @@ func convertPBCopyOut(copyOut []string) []*pb.Request_CmdCopyOutFile {
optional = true
n = strings.TrimSuffix(n, "?")
}
rt = append(rt, &pb.Request_CmdCopyOutFile{
rt = append(rt, pb.Request_CmdCopyOutFile_builder{
Name: n,
Optional: optional,
})
}.Build())
}
return rt
}
@ -222,18 +221,18 @@ func convertPBFiles(files []*model.CmdFile) []*pb.Request_File {
func convertPBFile(i model.CmdFile) *pb.Request_File {
switch {
case i.Src != nil:
return &pb.Request_File{File: &pb.Request_File_Local{Local: &pb.Request_LocalFile{Src: *i.Src}}}
return pb.Request_File_builder{Local: pb.Request_LocalFile_builder{Src: *i.Src}.Build()}.Build()
case i.Content != nil:
s := strToBytes(*i.Content)
return &pb.Request_File{File: &pb.Request_File_Memory{Memory: &pb.Request_MemoryFile{Content: s}}}
return pb.Request_File_builder{Memory: pb.Request_MemoryFile_builder{Content: s}.Build()}.Build()
case i.FileID != nil:
return &pb.Request_File{File: &pb.Request_File_Cached{Cached: &pb.Request_CachedFile{FileID: *i.FileID}}}
return pb.Request_File_builder{Cached: pb.Request_CachedFile_builder{FileID: *i.FileID}.Build()}.Build()
case i.Name != nil && i.Max != nil:
return &pb.Request_File{File: &pb.Request_File_Pipe{Pipe: &pb.Request_PipeCollector{Name: *i.Name, Max: *i.Max, Pipe: i.Pipe}}}
return pb.Request_File_builder{Pipe: pb.Request_PipeCollector_builder{Name: *i.Name, Max: *i.Max, Pipe: i.Pipe}.Build()}.Build()
case i.StreamIn:
return &pb.Request_File{File: &pb.Request_File_StreamIn{}}
return pb.Request_File_builder{StreamIn: &emptypb.Empty{}}.Build()
case i.StreamOut:
return &pb.Request_File{File: &pb.Request_File_StreamOut{}}
return pb.Request_File_builder{StreamOut: &emptypb.Empty{}}.Build()
}
return nil
}
@ -241,19 +240,19 @@ func convertPBFile(i model.CmdFile) *pb.Request_File {
func convertPBPipeMapping(pm []model.PipeMap) []*pb.Request_PipeMap {
var ret []*pb.Request_PipeMap
for _, p := range pm {
ret = append(ret, &pb.Request_PipeMap{
ret = append(ret, pb.Request_PipeMap_builder{
In: convertPBPipeIndex(p.In),
Out: convertPBPipeIndex(p.Out),
Name: p.Name,
Proxy: p.Proxy,
Max: uint64(p.Max),
})
}.Build())
}
return ret
}
func convertPBPipeIndex(pi model.PipeIndex) *pb.Request_PipeMap_PipeIndex {
return &pb.Request_PipeMap_PipeIndex{Index: int32(pi.Index), Fd: int32(pi.Fd)}
return pb.Request_PipeMap_PipeIndex_builder{Index: int32(pi.Index), Fd: int32(pi.Fd)}.Build()
}
type tokenAuth struct {

View File

@ -63,9 +63,9 @@ func (e *execServer) Exec(ctx context.Context, req *pb.Request) (*pb.Response, e
}
func (e *execServer) FileList(c context.Context, n *emptypb.Empty) (*pb.FileListType, error) {
return &pb.FileListType{
return pb.FileListType_builder{
FileIDs: e.fs.List(),
}, nil
}.Build(), nil
}
func (e *execServer) FileGet(c context.Context, f *pb.FileID) (*pb.FileContent, error) {
@ -83,10 +83,10 @@ func (e *execServer) FileGet(c context.Context, f *pb.FileID) (*pb.FileContent,
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
return &pb.FileContent{
return pb.FileContent_builder{
Name: name,
Content: content,
}, nil
}.Build(), nil
}
func (e *execServer) FileAdd(c context.Context, fc *pb.FileContent) (*pb.FileID, error) {
@ -103,9 +103,9 @@ func (e *execServer) FileAdd(c context.Context, fc *pb.FileContent) (*pb.FileID,
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
return &pb.FileID{
return pb.FileID_builder{
FileID: fid,
}, nil
}.Build(), nil
}
func (e *execServer) FileDelete(c context.Context, f *pb.FileID) (*emptypb.Empty, error) {
@ -117,23 +117,23 @@ func (e *execServer) FileDelete(c context.Context, f *pb.FileID) (*emptypb.Empty
}
func convertPBResponse(r model.Response) (*pb.Response, error) {
res := &pb.Response{
res := pb.Response_builder{
RequestID: r.RequestID,
Results: make([]*pb.Response_Result, 0, len(r.Results)),
Error: r.ErrorMsg,
}
}.Build()
for _, c := range r.Results {
rt, err := convertPBResult(c)
if err != nil {
return nil, err
}
res.Results = append(res.Results, rt)
res.SetResults(append(res.GetResults(), rt))
}
return res, nil
}
func convertPBResult(r model.Result) (*pb.Response_Result, error) {
return &pb.Response_Result{
return pb.Response_Result_builder{
Status: pb.Response_Result_StatusType(r.Status),
ExitStatus: int32(r.ExitStatus),
Error: r.Error,
@ -144,35 +144,35 @@ func convertPBResult(r model.Result) (*pb.Response_Result, error) {
Files: r.Buffs,
FileIDs: r.FileIDs,
FileError: convertPBFileError(r.FileError),
}, nil
}.Build(), nil
}
func convertPBFileError(fe []envexec.FileError) []*pb.Response_FileError {
rt := make([]*pb.Response_FileError, 0, len(fe))
for _, e := range fe {
rt = append(rt, &pb.Response_FileError{
rt = append(rt, pb.Response_FileError_builder{
Name: e.Name,
Type: pb.Response_FileError_ErrorType(e.Type),
Message: e.Message,
})
}.Build())
}
return rt
}
func convertPBRequest(r *pb.Request, srcPrefix []string) (req *worker.Request, err error) {
req = &worker.Request{
RequestID: r.RequestID,
Cmd: make([]worker.Cmd, 0, len(r.Cmd)),
PipeMapping: make([]worker.PipeMap, 0, len(r.PipeMapping)),
RequestID: r.GetRequestID(),
Cmd: make([]worker.Cmd, 0, len(r.GetCmd())),
PipeMapping: make([]worker.PipeMap, 0, len(r.GetPipeMapping())),
}
for _, c := range r.Cmd {
for _, c := range r.GetCmd() {
cm, err := convertPBCmd(c, srcPrefix)
if err != nil {
return nil, err
}
req.Cmd = append(req.Cmd, cm)
}
for _, p := range r.PipeMapping {
for _, p := range r.GetPipeMapping() {
pm := convertPBPipeMap(p)
req.PipeMapping = append(req.PipeMapping, pm)
}
@ -185,7 +185,7 @@ func convertPBPipeMap(p *pb.Request_PipeMap) worker.PipeMap {
Out: convertPBPipeIndex(p.GetOut()),
Proxy: p.GetProxy(),
Name: p.GetName(),
Limit: worker.Size(p.Max),
Limit: worker.Size(p.GetMax()),
}
}
@ -234,26 +234,26 @@ func convertPBCmd(c *pb.Request_CmdType, srcPrefix []string) (cm worker.Cmd, err
}
func convertPBFile(c *pb.Request_File, srcPrefix []string) (worker.CmdFile, error) {
switch c := c.File.(type) {
case nil:
switch c.WhichFile() {
case 0:
return nil, nil
case *pb.Request_File_Local:
case pb.Request_File_Local_case:
if len(srcPrefix) > 0 {
ok, err := model.CheckPathPrefixes(c.Local.GetSrc(), srcPrefix)
ok, err := model.CheckPathPrefixes(c.GetLocal().GetSrc(), srcPrefix)
if err != nil {
return nil, fmt.Errorf("check path prefixes: %w", err)
}
if !ok {
return nil, fmt.Errorf("file outside of prefix: %q, %q", c.Local.GetSrc(), srcPrefix)
return nil, fmt.Errorf("file outside of prefix: %q, %q", c.GetLocal().GetSrc(), srcPrefix)
}
}
return &worker.LocalFile{Src: c.Local.GetSrc()}, nil
case *pb.Request_File_Memory:
return &worker.MemoryFile{Content: c.Memory.GetContent()}, nil
case *pb.Request_File_Cached:
return &worker.CachedFile{FileID: c.Cached.GetFileID()}, nil
case *pb.Request_File_Pipe:
return &worker.Collector{Name: c.Pipe.GetName(), Max: envexec.Size(c.Pipe.GetMax()), Pipe: c.Pipe.GetPipe()}, nil
return &worker.LocalFile{Src: c.GetLocal().GetSrc()}, nil
case pb.Request_File_Memory_case:
return &worker.MemoryFile{Content: c.GetMemory().GetContent()}, nil
case pb.Request_File_Cached_case:
return &worker.CachedFile{FileID: c.GetCached().GetFileID()}, nil
case pb.Request_File_Pipe_case:
return &worker.Collector{Name: c.GetPipe().GetName(), Max: envexec.Size(c.GetPipe().GetMax()), Pipe: c.GetPipe().GetPipe()}, nil
}
return nil, fmt.Errorf("request file type not supported: %T", c)
}

View File

@ -8,6 +8,7 @@ import (
"github.com/criyle/go-judge/pb"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
var _ stream.Stream = &streamWrapper{}
@ -24,13 +25,13 @@ func (sw *streamWrapper) Send(r stream.Response) error {
if err != nil {
return status.Errorf(codes.Aborted, "response: %v", err)
}
res.Response = &pb.StreamResponse_ExecResponse{ExecResponse: resp}
res.SetExecResponse(proto.ValueOrDefault(resp))
case r.Output != nil:
res.Response = &pb.StreamResponse_ExecOutput{ExecOutput: &pb.StreamResponse_Output{
res.SetExecOutput(pb.StreamResponse_Output_builder{
Index: uint32(r.Output.Index),
Fd: uint32(r.Output.Fd),
Content: r.Output.Content,
}}
}.Build())
}
return sw.es.Send(res)
}
@ -40,25 +41,25 @@ func (sw *streamWrapper) Recv() (*stream.Request, error) {
if err != nil {
return nil, err
}
switch i := req.Request.(type) {
case *pb.StreamRequest_ExecRequest:
return &stream.Request{Request: convertPBStreamRequest(i.ExecRequest)}, nil
case *pb.StreamRequest_ExecInput:
switch req.WhichRequest() {
case pb.StreamRequest_ExecRequest_case:
return &stream.Request{Request: convertPBStreamRequest(req.GetExecRequest())}, nil
case pb.StreamRequest_ExecInput_case:
return &stream.Request{Input: &stream.InputRequest{
Index: int(i.ExecInput.Index),
Fd: int(i.ExecInput.Fd),
Content: i.ExecInput.Content,
Index: int(req.GetExecInput().GetIndex()),
Fd: int(req.GetExecInput().GetFd()),
Content: req.GetExecInput().GetContent(),
}}, nil
case *pb.StreamRequest_ExecResize:
case pb.StreamRequest_ExecResize_case:
return &stream.Request{Resize: &stream.ResizeRequest{
Index: int(i.ExecResize.Index),
Fd: int(i.ExecResize.Fd),
Rows: int(i.ExecResize.Rows),
Cols: int(i.ExecResize.Cols),
X: int(i.ExecResize.X),
Y: int(i.ExecResize.Y),
Index: int(req.GetExecResize().GetIndex()),
Fd: int(req.GetExecResize().GetFd()),
Rows: int(req.GetExecResize().GetRows()),
Cols: int(req.GetExecResize().GetCols()),
X: int(req.GetExecResize().GetX()),
Y: int(req.GetExecResize().GetY()),
}}, nil
case *pb.StreamRequest_ExecCancel:
case pb.StreamRequest_ExecCancel_case:
return &stream.Request{Cancel: &struct{}{}}, nil
}
return nil, errors.ErrUnsupported
@ -66,44 +67,44 @@ func (sw *streamWrapper) Recv() (*stream.Request, error) {
func convertPBStreamRequest(req *pb.Request) *model.Request {
ret := &model.Request{
RequestID: req.RequestID,
RequestID: req.GetRequestID(),
}
for _, cmd := range req.Cmd {
for _, cmd := range req.GetCmd() {
ret.Cmd = append(ret.Cmd, model.Cmd{
Args: cmd.Args,
Env: cmd.Env,
TTY: cmd.Tty,
Files: convertPBStreamFiles(cmd.Files),
CPULimit: cmd.CpuTimeLimit,
ClockLimit: cmd.ClockTimeLimit,
MemoryLimit: cmd.MemoryLimit,
StackLimit: cmd.StackLimit,
ProcLimit: cmd.ProcLimit,
CPURateLimit: cmd.CpuRateLimit,
CPUSetLimit: cmd.CpuSetLimit,
DataSegmentLimit: cmd.DataSegmentLimit,
AddressSpaceLimit: cmd.AddressSpaceLimit,
Args: cmd.GetArgs(),
Env: cmd.GetEnv(),
TTY: cmd.GetTty(),
Files: convertPBStreamFiles(cmd.GetFiles()),
CPULimit: cmd.GetCpuTimeLimit(),
ClockLimit: cmd.GetClockTimeLimit(),
MemoryLimit: cmd.GetMemoryLimit(),
StackLimit: cmd.GetStackLimit(),
ProcLimit: cmd.GetProcLimit(),
CPURateLimit: cmd.GetCpuRateLimit(),
CPUSetLimit: cmd.GetCpuSetLimit(),
DataSegmentLimit: cmd.GetDataSegmentLimit(),
AddressSpaceLimit: cmd.GetAddressSpaceLimit(),
CopyIn: convertPBStreamCopyIn(cmd),
CopyOut: convertStreamCopyOut(cmd.CopyOut),
CopyOutCached: convertStreamCopyOut(cmd.CopyOutCached),
CopyOutMax: cmd.CopyOutMax,
CopyOutDir: cmd.CopyOutDir,
CopyOut: convertStreamCopyOut(cmd.GetCopyOut()),
CopyOutCached: convertStreamCopyOut(cmd.GetCopyOutCached()),
CopyOutMax: cmd.GetCopyOutMax(),
CopyOutDir: cmd.GetCopyOutDir(),
})
}
for _, p := range req.PipeMapping {
for _, p := range req.GetPipeMapping() {
ret.PipeMapping = append(ret.PipeMapping, model.PipeMap{
In: convertPBStreamPipeIndex(p.In),
Out: convertPBStreamPipeIndex(p.Out),
Max: int64(p.Max),
Name: p.Name,
Proxy: p.Proxy,
In: convertPBStreamPipeIndex(p.GetIn()),
Out: convertPBStreamPipeIndex(p.GetOut()),
Max: int64(p.GetMax()),
Name: p.GetName(),
Proxy: p.GetProxy(),
})
}
return ret
}
func convertPBStreamPipeIndex(pi *pb.Request_PipeMap_PipeIndex) model.PipeIndex {
return model.PipeIndex{Index: int(pi.Index), Fd: int(pi.Fd)}
return model.PipeIndex{Index: int(pi.GetIndex()), Fd: int(pi.GetFd())}
}
func convertPBStreamFiles(files []*pb.Request_File) []*model.CmdFile {
@ -120,33 +121,33 @@ func convertPBStreamFiles(files []*pb.Request_File) []*model.CmdFile {
}
func convertPBStreamCopyIn(cmd *pb.Request_CmdType) map[string]model.CmdFile {
rt := make(map[string]model.CmdFile, len(cmd.CopyIn)+len(cmd.Symlinks))
for k, i := range cmd.CopyIn {
if i.File == nil {
rt := make(map[string]model.CmdFile, len(cmd.GetCopyIn())+len(cmd.GetSymlinks()))
for k, i := range cmd.GetCopyIn() {
if !i.HasFile() {
continue
}
rt[k] = convertPBStreamFile(i)
}
for k, v := range cmd.Symlinks {
for k, v := range cmd.GetSymlinks() {
rt[k] = model.CmdFile{Symlink: &v}
}
return rt
}
func convertPBStreamFile(i *pb.Request_File) model.CmdFile {
switch c := i.File.(type) {
case *pb.Request_File_Local:
return model.CmdFile{Src: &c.Local.Src}
case *pb.Request_File_Memory:
s := byteArrayToString(c.Memory.Content)
switch i.WhichFile() {
case pb.Request_File_Local_case:
return model.CmdFile{Src: proto.String(i.GetLocal().GetSrc())}
case pb.Request_File_Memory_case:
s := byteArrayToString(i.GetMemory().GetContent())
return model.CmdFile{Content: &s}
case *pb.Request_File_Cached:
return model.CmdFile{FileID: &c.Cached.FileID}
case *pb.Request_File_Pipe:
return model.CmdFile{Name: &c.Pipe.Name, Max: &c.Pipe.Max, Pipe: c.Pipe.Pipe}
case *pb.Request_File_StreamIn:
case pb.Request_File_Cached_case:
return model.CmdFile{FileID: proto.String(i.GetCached().GetFileID())}
case pb.Request_File_Pipe_case:
return model.CmdFile{Name: proto.String(i.GetPipe().GetName()), Max: proto.Int64(i.GetPipe().GetMax()), Pipe: i.GetPipe().GetPipe()}
case pb.Request_File_StreamIn_case:
return model.CmdFile{StreamIn: true}
case *pb.Request_File_StreamOut:
case pb.Request_File_StreamOut_case:
return model.CmdFile{StreamOut: true}
}
return model.CmdFile{}
@ -155,8 +156,8 @@ func convertPBStreamFile(i *pb.Request_File) model.CmdFile {
func convertStreamCopyOut(copyOut []*pb.Request_CmdCopyOutFile) []string {
rt := make([]string, 0, len(copyOut))
for _, n := range copyOut {
name := n.Name
if n.Optional {
name := n.GetName()
if n.GetOptional() {
name += "?"
}
rt = append(rt, name)

18
pb/README.md Normal file
View File

@ -0,0 +1,18 @@
# go-judge protobuf package
## Migration
Following the [Blog](https://go.dev/blog/protobuf-opaque) opaque API migration the pb package will be adapted to newer API for the future.
Although The client integration should stays the same giving the backwards compatibility promised by the protobuf team, it is still recommended to migrate to newer version.
[FAQ](https://protobuf.dev/reference/go/opaque-faq/)
For clients with older API, it is recommended to stick with `v1.0.1` for now.
To migration to newer version:
- Upgrade to `v1.1.0`
- Following the [migration guide](https://protobuf.dev/reference/go/opaque-migration/) to install the `open2opaque` tool
- Use the tool to migrate existing code to use newer version
- Upgrade to `v1.2.0` to finish the migration

View File

@ -4,13 +4,15 @@
// protoc v6.31.1
// source: file.proto
//go:build !protoopaque
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
_ "google.golang.org/protobuf/types/gofeaturespb"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
@ -22,7 +24,7 @@ const (
)
type FileID struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"hybrid.v1"`
FileID string `protobuf:"bytes,1,opt,name=fileID" json:"fileID,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
@ -53,11 +55,6 @@ func (x *FileID) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use FileID.ProtoReflect.Descriptor instead.
func (*FileID) Descriptor() ([]byte, []int) {
return file_file_proto_rawDescGZIP(), []int{0}
}
func (x *FileID) GetFileID() string {
if x != nil {
return x.FileID
@ -65,8 +62,26 @@ func (x *FileID) GetFileID() string {
return ""
}
func (x *FileID) SetFileID(v string) {
x.FileID = v
}
type FileID_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
FileID string
}
func (b0 FileID_builder) Build() *FileID {
m0 := &FileID{}
b, x := &b0, m0
_, _ = b, x
x.FileID = b.FileID
return m0
}
type FileContent struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"hybrid.v1"`
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
Content []byte `protobuf:"bytes,2,opt,name=content" json:"content,omitempty"`
unknownFields protoimpl.UnknownFields
@ -98,11 +113,6 @@ func (x *FileContent) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use FileContent.ProtoReflect.Descriptor instead.
func (*FileContent) Descriptor() ([]byte, []int) {
return file_file_proto_rawDescGZIP(), []int{1}
}
func (x *FileContent) GetName() string {
if x != nil {
return x.Name
@ -117,8 +127,35 @@ func (x *FileContent) GetContent() []byte {
return nil
}
func (x *FileContent) SetName(v string) {
x.Name = v
}
func (x *FileContent) SetContent(v []byte) {
if v == nil {
v = []byte{}
}
x.Content = v
}
type FileContent_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
Name string
Content []byte
}
func (b0 FileContent_builder) Build() *FileContent {
m0 := &FileContent{}
b, x := &b0, m0
_, _ = b, x
x.Name = b.Name
x.Content = b.Content
return m0
}
type FileListType struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"hybrid.v1"`
FileIDs map[string]string `protobuf:"bytes,1,rep,name=fileIDs" json:"fileIDs,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
@ -149,11 +186,6 @@ func (x *FileListType) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use FileListType.ProtoReflect.Descriptor instead.
func (*FileListType) Descriptor() ([]byte, []int) {
return file_file_proto_rawDescGZIP(), []int{2}
}
func (x *FileListType) GetFileIDs() map[string]string {
if x != nil {
return x.FileIDs
@ -161,12 +193,30 @@ func (x *FileListType) GetFileIDs() map[string]string {
return nil
}
func (x *FileListType) SetFileIDs(v map[string]string) {
x.FileIDs = v
}
type FileListType_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
FileIDs map[string]string
}
func (b0 FileListType_builder) Build() *FileListType {
m0 := &FileListType{}
b, x := &b0, m0
_, _ = b, x
x.FileIDs = b.FileIDs
return m0
}
var File_file_proto protoreflect.FileDescriptor
const file_file_proto_rawDesc = "" +
"\n" +
"\n" +
"file.proto\x12\x02pb\" \n" +
"file.proto\x12\x02pb\x1a!google/protobuf/go_features.proto\" \n" +
"\x06FileID\x12\x16\n" +
"\x06fileID\x18\x01 \x01(\tR\x06fileID\";\n" +
"\vFileContent\x12\x12\n" +
@ -176,19 +226,7 @@ const file_file_proto_rawDesc = "" +
"\afileIDs\x18\x01 \x03(\v2\x1d.pb.FileListType.FileIDsEntryR\afileIDs\x1a:\n" +
"\fFileIDsEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B$Z\x1dgithub.com/criyle/go-judge/pb\x92\x03\x02\b\x02b\beditionsp\xe8\a"
var (
file_file_proto_rawDescOnce sync.Once
file_file_proto_rawDescData []byte
)
func file_file_proto_rawDescGZIP() []byte {
file_file_proto_rawDescOnce.Do(func() {
file_file_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_file_proto_rawDesc), len(file_file_proto_rawDesc)))
})
return file_file_proto_rawDescData
}
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B)Z\x1dgithub.com/criyle/go-judge/pb\x92\x03\a\xd2>\x02\x10\x02\b\x02b\beditionsp\xe8\a"
var file_file_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_file_proto_goTypes = []any{

View File

@ -1,9 +1,11 @@
edition = "2023";
package pb;
import "google/protobuf/go_features.proto";
option features.field_presence = IMPLICIT;
option go_package = "github.com/criyle/go-judge/pb";
option features.(pb.go).api_level = API_HYBRID;
message FileID { string fileID = 1; }

269
pb/file_protoopaque.pb.go Normal file
View File

@ -0,0 +1,269 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.6
// protoc v6.31.1
// source: file.proto
//go:build protoopaque
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
_ "google.golang.org/protobuf/types/gofeaturespb"
reflect "reflect"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type FileID struct {
state protoimpl.MessageState `protogen:"opaque.v1"`
xxx_hidden_FileID string `protobuf:"bytes,1,opt,name=fileID"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *FileID) Reset() {
*x = FileID{}
mi := &file_file_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *FileID) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FileID) ProtoMessage() {}
func (x *FileID) ProtoReflect() protoreflect.Message {
mi := &file_file_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *FileID) GetFileID() string {
if x != nil {
return x.xxx_hidden_FileID
}
return ""
}
func (x *FileID) SetFileID(v string) {
x.xxx_hidden_FileID = v
}
type FileID_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
FileID string
}
func (b0 FileID_builder) Build() *FileID {
m0 := &FileID{}
b, x := &b0, m0
_, _ = b, x
x.xxx_hidden_FileID = b.FileID
return m0
}
type FileContent struct {
state protoimpl.MessageState `protogen:"opaque.v1"`
xxx_hidden_Name string `protobuf:"bytes,1,opt,name=name"`
xxx_hidden_Content []byte `protobuf:"bytes,2,opt,name=content"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *FileContent) Reset() {
*x = FileContent{}
mi := &file_file_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *FileContent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FileContent) ProtoMessage() {}
func (x *FileContent) ProtoReflect() protoreflect.Message {
mi := &file_file_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *FileContent) GetName() string {
if x != nil {
return x.xxx_hidden_Name
}
return ""
}
func (x *FileContent) GetContent() []byte {
if x != nil {
return x.xxx_hidden_Content
}
return nil
}
func (x *FileContent) SetName(v string) {
x.xxx_hidden_Name = v
}
func (x *FileContent) SetContent(v []byte) {
if v == nil {
v = []byte{}
}
x.xxx_hidden_Content = v
}
type FileContent_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
Name string
Content []byte
}
func (b0 FileContent_builder) Build() *FileContent {
m0 := &FileContent{}
b, x := &b0, m0
_, _ = b, x
x.xxx_hidden_Name = b.Name
x.xxx_hidden_Content = b.Content
return m0
}
type FileListType struct {
state protoimpl.MessageState `protogen:"opaque.v1"`
xxx_hidden_FileIDs map[string]string `protobuf:"bytes,1,rep,name=fileIDs" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *FileListType) Reset() {
*x = FileListType{}
mi := &file_file_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *FileListType) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FileListType) ProtoMessage() {}
func (x *FileListType) ProtoReflect() protoreflect.Message {
mi := &file_file_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *FileListType) GetFileIDs() map[string]string {
if x != nil {
return x.xxx_hidden_FileIDs
}
return nil
}
func (x *FileListType) SetFileIDs(v map[string]string) {
x.xxx_hidden_FileIDs = v
}
type FileListType_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
FileIDs map[string]string
}
func (b0 FileListType_builder) Build() *FileListType {
m0 := &FileListType{}
b, x := &b0, m0
_, _ = b, x
x.xxx_hidden_FileIDs = b.FileIDs
return m0
}
var File_file_proto protoreflect.FileDescriptor
const file_file_proto_rawDesc = "" +
"\n" +
"\n" +
"file.proto\x12\x02pb\x1a!google/protobuf/go_features.proto\" \n" +
"\x06FileID\x12\x16\n" +
"\x06fileID\x18\x01 \x01(\tR\x06fileID\";\n" +
"\vFileContent\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x12\x18\n" +
"\acontent\x18\x02 \x01(\fR\acontent\"\x83\x01\n" +
"\fFileListType\x127\n" +
"\afileIDs\x18\x01 \x03(\v2\x1d.pb.FileListType.FileIDsEntryR\afileIDs\x1a:\n" +
"\fFileIDsEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B)Z\x1dgithub.com/criyle/go-judge/pb\x92\x03\a\xd2>\x02\x10\x02\b\x02b\beditionsp\xe8\a"
var file_file_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_file_proto_goTypes = []any{
(*FileID)(nil), // 0: pb.FileID
(*FileContent)(nil), // 1: pb.FileContent
(*FileListType)(nil), // 2: pb.FileListType
nil, // 3: pb.FileListType.FileIDsEntry
}
var file_file_proto_depIdxs = []int32{
3, // 0: pb.FileListType.fileIDs:type_name -> pb.FileListType.FileIDsEntry
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_file_proto_init() }
func file_file_proto_init() {
if File_file_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_file_proto_rawDesc), len(file_file_proto_rawDesc)),
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_file_proto_goTypes,
DependencyIndexes: file_file_proto_depIdxs,
MessageInfos: file_file_proto_msgTypes,
}.Build()
File_file_proto = out.File
file_file_proto_goTypes = nil
file_file_proto_depIdxs = nil
}

View File

@ -1,3 +1,4 @@
// Package pb stores the protobuf implementation for the go-judge gRPC interface
package pb
//go:generate protoc --proto_path=./ --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative judge.proto request.proto response.proto stream_request.proto stream_response.proto file.proto

View File

@ -4,11 +4,14 @@
// protoc v6.31.1
// source: judge.proto
//go:build !protoopaque
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
_ "google.golang.org/protobuf/types/gofeaturespb"
emptypb "google.golang.org/protobuf/types/known/emptypb"
reflect "reflect"
unsafe "unsafe"
@ -26,7 +29,7 @@ var File_judge_proto protoreflect.FileDescriptor
const file_judge_proto_rawDesc = "" +
"\n" +
"\vjudge.proto\x12\x02pb\x1a\x1bgoogle/protobuf/empty.proto\x1a\rrequest.proto\x1a\x0eresponse.proto\x1a\x14stream_request.proto\x1a\x15stream_response.proto\x1a\n" +
"file.proto2\x9e\x02\n" +
"file.proto\x1a!google/protobuf/go_features.proto2\x9e\x02\n" +
"\bExecutor\x12!\n" +
"\x04Exec\x12\v.pb.Request\x1a\f.pb.Response\x127\n" +
"\n" +
@ -38,7 +41,7 @@ const file_judge_proto_rawDesc = "" +
".pb.FileID\x120\n" +
"\n" +
"FileDelete\x12\n" +
".pb.FileID\x1a\x16.google.protobuf.EmptyB$Z\x1dgithub.com/criyle/go-judge/pb\x92\x03\x02\b\x02b\beditionsp\xe8\a"
".pb.FileID\x1a\x16.google.protobuf.EmptyB)Z\x1dgithub.com/criyle/go-judge/pb\x92\x03\a\xd2>\x02\x10\x02\b\x02b\beditionsp\xe8\a"
var file_judge_proto_goTypes = []any{
(*Request)(nil), // 0: pb.Request

View File

@ -4,6 +4,7 @@ package pb;
option features.field_presence = IMPLICIT;
option go_package = "github.com/criyle/go-judge/pb";
option features.(pb.go).api_level = API_HYBRID;
import "google/protobuf/empty.proto";
import "request.proto";
@ -11,6 +12,7 @@ import "response.proto";
import "stream_request.proto";
import "stream_response.proto";
import "file.proto";
import "google/protobuf/go_features.proto";
service Executor {
// Exec defines unary RPC to run a program with resource limitations

102
pb/judge_protoopaque.pb.go Normal file
View File

@ -0,0 +1,102 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.6
// protoc v6.31.1
// source: judge.proto
//go:build protoopaque
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
_ "google.golang.org/protobuf/types/gofeaturespb"
emptypb "google.golang.org/protobuf/types/known/emptypb"
reflect "reflect"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
var File_judge_proto protoreflect.FileDescriptor
const file_judge_proto_rawDesc = "" +
"\n" +
"\vjudge.proto\x12\x02pb\x1a\x1bgoogle/protobuf/empty.proto\x1a\rrequest.proto\x1a\x0eresponse.proto\x1a\x14stream_request.proto\x1a\x15stream_response.proto\x1a\n" +
"file.proto\x1a!google/protobuf/go_features.proto2\x9e\x02\n" +
"\bExecutor\x12!\n" +
"\x04Exec\x12\v.pb.Request\x1a\f.pb.Response\x127\n" +
"\n" +
"ExecStream\x12\x11.pb.StreamRequest\x1a\x12.pb.StreamResponse(\x010\x01\x124\n" +
"\bFileList\x12\x16.google.protobuf.Empty\x1a\x10.pb.FileListType\x12&\n" +
"\aFileGet\x12\n" +
".pb.FileID\x1a\x0f.pb.FileContent\x12&\n" +
"\aFileAdd\x12\x0f.pb.FileContent\x1a\n" +
".pb.FileID\x120\n" +
"\n" +
"FileDelete\x12\n" +
".pb.FileID\x1a\x16.google.protobuf.EmptyB)Z\x1dgithub.com/criyle/go-judge/pb\x92\x03\a\xd2>\x02\x10\x02\b\x02b\beditionsp\xe8\a"
var file_judge_proto_goTypes = []any{
(*Request)(nil), // 0: pb.Request
(*StreamRequest)(nil), // 1: pb.StreamRequest
(*emptypb.Empty)(nil), // 2: google.protobuf.Empty
(*FileID)(nil), // 3: pb.FileID
(*FileContent)(nil), // 4: pb.FileContent
(*Response)(nil), // 5: pb.Response
(*StreamResponse)(nil), // 6: pb.StreamResponse
(*FileListType)(nil), // 7: pb.FileListType
}
var file_judge_proto_depIdxs = []int32{
0, // 0: pb.Executor.Exec:input_type -> pb.Request
1, // 1: pb.Executor.ExecStream:input_type -> pb.StreamRequest
2, // 2: pb.Executor.FileList:input_type -> google.protobuf.Empty
3, // 3: pb.Executor.FileGet:input_type -> pb.FileID
4, // 4: pb.Executor.FileAdd:input_type -> pb.FileContent
3, // 5: pb.Executor.FileDelete:input_type -> pb.FileID
5, // 6: pb.Executor.Exec:output_type -> pb.Response
6, // 7: pb.Executor.ExecStream:output_type -> pb.StreamResponse
7, // 8: pb.Executor.FileList:output_type -> pb.FileListType
4, // 9: pb.Executor.FileGet:output_type -> pb.FileContent
3, // 10: pb.Executor.FileAdd:output_type -> pb.FileID
2, // 11: pb.Executor.FileDelete:output_type -> google.protobuf.Empty
6, // [6:12] is the sub-list for method output_type
0, // [0:6] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_judge_proto_init() }
func file_judge_proto_init() {
if File_judge_proto != nil {
return
}
file_request_proto_init()
file_response_proto_init()
file_stream_request_proto_init()
file_stream_response_proto_init()
file_file_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_judge_proto_rawDesc), len(file_judge_proto_rawDesc)),
NumEnums: 0,
NumMessages: 0,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_judge_proto_goTypes,
DependencyIndexes: file_judge_proto_depIdxs,
}.Build()
File_judge_proto = out.File
file_judge_proto_goTypes = nil
file_judge_proto_depIdxs = nil
}

View File

@ -4,14 +4,16 @@
// protoc v6.31.1
// source: request.proto
//go:build !protoopaque
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
_ "google.golang.org/protobuf/types/gofeaturespb"
emptypb "google.golang.org/protobuf/types/known/emptypb"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
@ -23,7 +25,7 @@ const (
)
type Request struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"hybrid.v1"`
RequestID string `protobuf:"bytes,1,opt,name=requestID" json:"requestID,omitempty"`
Cmd []*Request_CmdType `protobuf:"bytes,2,rep,name=cmd" json:"cmd,omitempty"`
PipeMapping []*Request_PipeMap `protobuf:"bytes,3,rep,name=pipeMapping" json:"pipeMapping,omitempty"`
@ -56,11 +58,6 @@ func (x *Request) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use Request.ProtoReflect.Descriptor instead.
func (*Request) Descriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{0}
}
func (x *Request) GetRequestID() string {
if x != nil {
return x.RequestID
@ -82,8 +79,38 @@ func (x *Request) GetPipeMapping() []*Request_PipeMap {
return nil
}
func (x *Request) SetRequestID(v string) {
x.RequestID = v
}
func (x *Request) SetCmd(v []*Request_CmdType) {
x.Cmd = v
}
func (x *Request) SetPipeMapping(v []*Request_PipeMap) {
x.PipeMapping = v
}
type Request_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
RequestID string
Cmd []*Request_CmdType
PipeMapping []*Request_PipeMap
}
func (b0 Request_builder) Build() *Request {
m0 := &Request{}
b, x := &b0, m0
_, _ = b, x
x.RequestID = b.RequestID
x.Cmd = b.Cmd
x.PipeMapping = b.PipeMapping
return m0
}
type Request_LocalFile struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"hybrid.v1"`
Src string `protobuf:"bytes,1,opt,name=src" json:"src,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
@ -114,11 +141,6 @@ func (x *Request_LocalFile) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use Request_LocalFile.ProtoReflect.Descriptor instead.
func (*Request_LocalFile) Descriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{0, 0}
}
func (x *Request_LocalFile) GetSrc() string {
if x != nil {
return x.Src
@ -126,8 +148,26 @@ func (x *Request_LocalFile) GetSrc() string {
return ""
}
func (x *Request_LocalFile) SetSrc(v string) {
x.Src = v
}
type Request_LocalFile_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
Src string
}
func (b0 Request_LocalFile_builder) Build() *Request_LocalFile {
m0 := &Request_LocalFile{}
b, x := &b0, m0
_, _ = b, x
x.Src = b.Src
return m0
}
type Request_MemoryFile struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"hybrid.v1"`
Content []byte `protobuf:"bytes,1,opt,name=content" json:"content,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
@ -158,11 +198,6 @@ func (x *Request_MemoryFile) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use Request_MemoryFile.ProtoReflect.Descriptor instead.
func (*Request_MemoryFile) Descriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{0, 1}
}
func (x *Request_MemoryFile) GetContent() []byte {
if x != nil {
return x.Content
@ -170,8 +205,29 @@ func (x *Request_MemoryFile) GetContent() []byte {
return nil
}
func (x *Request_MemoryFile) SetContent(v []byte) {
if v == nil {
v = []byte{}
}
x.Content = v
}
type Request_MemoryFile_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
Content []byte
}
func (b0 Request_MemoryFile_builder) Build() *Request_MemoryFile {
m0 := &Request_MemoryFile{}
b, x := &b0, m0
_, _ = b, x
x.Content = b.Content
return m0
}
type Request_CachedFile struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"hybrid.v1"`
FileID string `protobuf:"bytes,1,opt,name=fileID" json:"fileID,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
@ -202,11 +258,6 @@ func (x *Request_CachedFile) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use Request_CachedFile.ProtoReflect.Descriptor instead.
func (*Request_CachedFile) Descriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{0, 2}
}
func (x *Request_CachedFile) GetFileID() string {
if x != nil {
return x.FileID
@ -214,8 +265,26 @@ func (x *Request_CachedFile) GetFileID() string {
return ""
}
func (x *Request_CachedFile) SetFileID(v string) {
x.FileID = v
}
type Request_CachedFile_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
FileID string
}
func (b0 Request_CachedFile_builder) Build() *Request_CachedFile {
m0 := &Request_CachedFile{}
b, x := &b0, m0
_, _ = b, x
x.FileID = b.FileID
return m0
}
type Request_PipeCollector struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"hybrid.v1"`
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
Max int64 `protobuf:"varint,2,opt,name=max" json:"max,omitempty"`
Pipe bool `protobuf:"varint,3,opt,name=pipe" json:"pipe,omitempty"`
@ -248,11 +317,6 @@ func (x *Request_PipeCollector) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use Request_PipeCollector.ProtoReflect.Descriptor instead.
func (*Request_PipeCollector) Descriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{0, 3}
}
func (x *Request_PipeCollector) GetName() string {
if x != nil {
return x.Name
@ -274,8 +338,38 @@ func (x *Request_PipeCollector) GetPipe() bool {
return false
}
func (x *Request_PipeCollector) SetName(v string) {
x.Name = v
}
func (x *Request_PipeCollector) SetMax(v int64) {
x.Max = v
}
func (x *Request_PipeCollector) SetPipe(v bool) {
x.Pipe = v
}
type Request_PipeCollector_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
Name string
Max int64
Pipe bool
}
func (b0 Request_PipeCollector_builder) Build() *Request_PipeCollector {
m0 := &Request_PipeCollector{}
b, x := &b0, m0
_, _ = b, x
x.Name = b.Name
x.Max = b.Max
x.Pipe = b.Pipe
return m0
}
type Request_File struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"hybrid.v1"`
// Types that are valid to be assigned to File:
//
// *Request_File_Local
@ -314,11 +408,6 @@ func (x *Request_File) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use Request_File.ProtoReflect.Descriptor instead.
func (*Request_File) Descriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{0, 4}
}
func (x *Request_File) GetFile() isRequest_File_File {
if x != nil {
return x.File
@ -380,6 +469,229 @@ func (x *Request_File) GetStreamOut() *emptypb.Empty {
return nil
}
func (x *Request_File) SetLocal(v *Request_LocalFile) {
if v == nil {
x.File = nil
return
}
x.File = &Request_File_Local{v}
}
func (x *Request_File) SetMemory(v *Request_MemoryFile) {
if v == nil {
x.File = nil
return
}
x.File = &Request_File_Memory{v}
}
func (x *Request_File) SetCached(v *Request_CachedFile) {
if v == nil {
x.File = nil
return
}
x.File = &Request_File_Cached{v}
}
func (x *Request_File) SetPipe(v *Request_PipeCollector) {
if v == nil {
x.File = nil
return
}
x.File = &Request_File_Pipe{v}
}
func (x *Request_File) SetStreamIn(v *emptypb.Empty) {
if v == nil {
x.File = nil
return
}
x.File = &Request_File_StreamIn{v}
}
func (x *Request_File) SetStreamOut(v *emptypb.Empty) {
if v == nil {
x.File = nil
return
}
x.File = &Request_File_StreamOut{v}
}
func (x *Request_File) HasFile() bool {
if x == nil {
return false
}
return x.File != nil
}
func (x *Request_File) HasLocal() bool {
if x == nil {
return false
}
_, ok := x.File.(*Request_File_Local)
return ok
}
func (x *Request_File) HasMemory() bool {
if x == nil {
return false
}
_, ok := x.File.(*Request_File_Memory)
return ok
}
func (x *Request_File) HasCached() bool {
if x == nil {
return false
}
_, ok := x.File.(*Request_File_Cached)
return ok
}
func (x *Request_File) HasPipe() bool {
if x == nil {
return false
}
_, ok := x.File.(*Request_File_Pipe)
return ok
}
func (x *Request_File) HasStreamIn() bool {
if x == nil {
return false
}
_, ok := x.File.(*Request_File_StreamIn)
return ok
}
func (x *Request_File) HasStreamOut() bool {
if x == nil {
return false
}
_, ok := x.File.(*Request_File_StreamOut)
return ok
}
func (x *Request_File) ClearFile() {
x.File = nil
}
func (x *Request_File) ClearLocal() {
if _, ok := x.File.(*Request_File_Local); ok {
x.File = nil
}
}
func (x *Request_File) ClearMemory() {
if _, ok := x.File.(*Request_File_Memory); ok {
x.File = nil
}
}
func (x *Request_File) ClearCached() {
if _, ok := x.File.(*Request_File_Cached); ok {
x.File = nil
}
}
func (x *Request_File) ClearPipe() {
if _, ok := x.File.(*Request_File_Pipe); ok {
x.File = nil
}
}
func (x *Request_File) ClearStreamIn() {
if _, ok := x.File.(*Request_File_StreamIn); ok {
x.File = nil
}
}
func (x *Request_File) ClearStreamOut() {
if _, ok := x.File.(*Request_File_StreamOut); ok {
x.File = nil
}
}
const Request_File_File_not_set_case case_Request_File_File = 0
const Request_File_Local_case case_Request_File_File = 1
const Request_File_Memory_case case_Request_File_File = 2
const Request_File_Cached_case case_Request_File_File = 3
const Request_File_Pipe_case case_Request_File_File = 4
const Request_File_StreamIn_case case_Request_File_File = 5
const Request_File_StreamOut_case case_Request_File_File = 6
func (x *Request_File) WhichFile() case_Request_File_File {
if x == nil {
return Request_File_File_not_set_case
}
switch x.File.(type) {
case *Request_File_Local:
return Request_File_Local_case
case *Request_File_Memory:
return Request_File_Memory_case
case *Request_File_Cached:
return Request_File_Cached_case
case *Request_File_Pipe:
return Request_File_Pipe_case
case *Request_File_StreamIn:
return Request_File_StreamIn_case
case *Request_File_StreamOut:
return Request_File_StreamOut_case
default:
return Request_File_File_not_set_case
}
}
type Request_File_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Fields of oneof File:
Local *Request_LocalFile
Memory *Request_MemoryFile
Cached *Request_CachedFile
Pipe *Request_PipeCollector
// streamIn only valid in streaming RPC
StreamIn *emptypb.Empty
// streamOut only valid in streaming RPC
StreamOut *emptypb.Empty
// -- end of File
}
func (b0 Request_File_builder) Build() *Request_File {
m0 := &Request_File{}
b, x := &b0, m0
_, _ = b, x
if b.Local != nil {
x.File = &Request_File_Local{b.Local}
}
if b.Memory != nil {
x.File = &Request_File_Memory{b.Memory}
}
if b.Cached != nil {
x.File = &Request_File_Cached{b.Cached}
}
if b.Pipe != nil {
x.File = &Request_File_Pipe{b.Pipe}
}
if b.StreamIn != nil {
x.File = &Request_File_StreamIn{b.StreamIn}
}
if b.StreamOut != nil {
x.File = &Request_File_StreamOut{b.StreamOut}
}
return m0
}
type case_Request_File_File protoreflect.FieldNumber
func (x case_Request_File_File) String() string {
md := file_request_proto_msgTypes[5].Descriptor()
if x == 0 {
return "not set"
}
return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x))
}
type isRequest_File_File interface {
isRequest_File_File()
}
@ -423,7 +735,7 @@ func (*Request_File_StreamIn) isRequest_File_File() {}
func (*Request_File_StreamOut) isRequest_File_File() {}
type Request_CmdType struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"hybrid.v1"`
Args []string `protobuf:"bytes,1,rep,name=args" json:"args,omitempty"`
Env []string `protobuf:"bytes,2,rep,name=env" json:"env,omitempty"`
Files []*Request_File `protobuf:"bytes,3,rep,name=files" json:"files,omitempty"`
@ -472,11 +784,6 @@ func (x *Request_CmdType) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use Request_CmdType.ProtoReflect.Descriptor instead.
func (*Request_CmdType) Descriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{0, 5}
}
func (x *Request_CmdType) GetArgs() []string {
if x != nil {
return x.Args
@ -610,8 +917,134 @@ func (x *Request_CmdType) GetCopyOutMax() uint64 {
return 0
}
func (x *Request_CmdType) SetArgs(v []string) {
x.Args = v
}
func (x *Request_CmdType) SetEnv(v []string) {
x.Env = v
}
func (x *Request_CmdType) SetFiles(v []*Request_File) {
x.Files = v
}
func (x *Request_CmdType) SetTty(v bool) {
x.Tty = v
}
func (x *Request_CmdType) SetCpuTimeLimit(v uint64) {
x.CpuTimeLimit = v
}
func (x *Request_CmdType) SetClockTimeLimit(v uint64) {
x.ClockTimeLimit = v
}
func (x *Request_CmdType) SetMemoryLimit(v uint64) {
x.MemoryLimit = v
}
func (x *Request_CmdType) SetStackLimit(v uint64) {
x.StackLimit = v
}
func (x *Request_CmdType) SetProcLimit(v uint64) {
x.ProcLimit = v
}
func (x *Request_CmdType) SetCpuRateLimit(v uint64) {
x.CpuRateLimit = v
}
func (x *Request_CmdType) SetCpuSetLimit(v string) {
x.CpuSetLimit = v
}
func (x *Request_CmdType) SetDataSegmentLimit(v bool) {
x.DataSegmentLimit = v
}
func (x *Request_CmdType) SetAddressSpaceLimit(v bool) {
x.AddressSpaceLimit = v
}
func (x *Request_CmdType) SetCopyIn(v map[string]*Request_File) {
x.CopyIn = v
}
func (x *Request_CmdType) SetSymlinks(v map[string]string) {
x.Symlinks = v
}
func (x *Request_CmdType) SetCopyOut(v []*Request_CmdCopyOutFile) {
x.CopyOut = v
}
func (x *Request_CmdType) SetCopyOutCached(v []*Request_CmdCopyOutFile) {
x.CopyOutCached = v
}
func (x *Request_CmdType) SetCopyOutDir(v string) {
x.CopyOutDir = v
}
func (x *Request_CmdType) SetCopyOutMax(v uint64) {
x.CopyOutMax = v
}
type Request_CmdType_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
Args []string
Env []string
Files []*Request_File
Tty bool
CpuTimeLimit uint64
ClockTimeLimit uint64
MemoryLimit uint64
StackLimit uint64
ProcLimit uint64
CpuRateLimit uint64
CpuSetLimit string
DataSegmentLimit bool
AddressSpaceLimit bool
CopyIn map[string]*Request_File
Symlinks map[string]string
CopyOut []*Request_CmdCopyOutFile
CopyOutCached []*Request_CmdCopyOutFile
CopyOutDir string
CopyOutMax uint64
}
func (b0 Request_CmdType_builder) Build() *Request_CmdType {
m0 := &Request_CmdType{}
b, x := &b0, m0
_, _ = b, x
x.Args = b.Args
x.Env = b.Env
x.Files = b.Files
x.Tty = b.Tty
x.CpuTimeLimit = b.CpuTimeLimit
x.ClockTimeLimit = b.ClockTimeLimit
x.MemoryLimit = b.MemoryLimit
x.StackLimit = b.StackLimit
x.ProcLimit = b.ProcLimit
x.CpuRateLimit = b.CpuRateLimit
x.CpuSetLimit = b.CpuSetLimit
x.DataSegmentLimit = b.DataSegmentLimit
x.AddressSpaceLimit = b.AddressSpaceLimit
x.CopyIn = b.CopyIn
x.Symlinks = b.Symlinks
x.CopyOut = b.CopyOut
x.CopyOutCached = b.CopyOutCached
x.CopyOutDir = b.CopyOutDir
x.CopyOutMax = b.CopyOutMax
return m0
}
type Request_CmdCopyOutFile struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"hybrid.v1"`
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
Optional bool `protobuf:"varint,2,opt,name=optional" json:"optional,omitempty"`
unknownFields protoimpl.UnknownFields
@ -643,11 +1076,6 @@ func (x *Request_CmdCopyOutFile) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use Request_CmdCopyOutFile.ProtoReflect.Descriptor instead.
func (*Request_CmdCopyOutFile) Descriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{0, 6}
}
func (x *Request_CmdCopyOutFile) GetName() string {
if x != nil {
return x.Name
@ -662,8 +1090,32 @@ func (x *Request_CmdCopyOutFile) GetOptional() bool {
return false
}
func (x *Request_CmdCopyOutFile) SetName(v string) {
x.Name = v
}
func (x *Request_CmdCopyOutFile) SetOptional(v bool) {
x.Optional = v
}
type Request_CmdCopyOutFile_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
Name string
Optional bool
}
func (b0 Request_CmdCopyOutFile_builder) Build() *Request_CmdCopyOutFile {
m0 := &Request_CmdCopyOutFile{}
b, x := &b0, m0
_, _ = b, x
x.Name = b.Name
x.Optional = b.Optional
return m0
}
type Request_PipeMap struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"hybrid.v1"`
In *Request_PipeMap_PipeIndex `protobuf:"bytes,1,opt,name=in" json:"in,omitempty"`
Out *Request_PipeMap_PipeIndex `protobuf:"bytes,2,opt,name=out" json:"out,omitempty"`
Proxy bool `protobuf:"varint,3,opt,name=proxy" json:"proxy,omitempty"`
@ -698,11 +1150,6 @@ func (x *Request_PipeMap) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use Request_PipeMap.ProtoReflect.Descriptor instead.
func (*Request_PipeMap) Descriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{0, 7}
}
func (x *Request_PipeMap) GetIn() *Request_PipeMap_PipeIndex {
if x != nil {
return x.In
@ -738,8 +1185,72 @@ func (x *Request_PipeMap) GetMax() uint64 {
return 0
}
func (x *Request_PipeMap) SetIn(v *Request_PipeMap_PipeIndex) {
x.In = v
}
func (x *Request_PipeMap) SetOut(v *Request_PipeMap_PipeIndex) {
x.Out = v
}
func (x *Request_PipeMap) SetProxy(v bool) {
x.Proxy = v
}
func (x *Request_PipeMap) SetName(v string) {
x.Name = v
}
func (x *Request_PipeMap) SetMax(v uint64) {
x.Max = v
}
func (x *Request_PipeMap) HasIn() bool {
if x == nil {
return false
}
return x.In != nil
}
func (x *Request_PipeMap) HasOut() bool {
if x == nil {
return false
}
return x.Out != nil
}
func (x *Request_PipeMap) ClearIn() {
x.In = nil
}
func (x *Request_PipeMap) ClearOut() {
x.Out = nil
}
type Request_PipeMap_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
In *Request_PipeMap_PipeIndex
Out *Request_PipeMap_PipeIndex
Proxy bool
Name string
Max uint64
}
func (b0 Request_PipeMap_builder) Build() *Request_PipeMap {
m0 := &Request_PipeMap{}
b, x := &b0, m0
_, _ = b, x
x.In = b.In
x.Out = b.Out
x.Proxy = b.Proxy
x.Name = b.Name
x.Max = b.Max
return m0
}
type Request_PipeMap_PipeIndex struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"hybrid.v1"`
Index int32 `protobuf:"varint,1,opt,name=index" json:"index,omitempty"`
Fd int32 `protobuf:"varint,2,opt,name=fd" json:"fd,omitempty"`
unknownFields protoimpl.UnknownFields
@ -771,11 +1282,6 @@ func (x *Request_PipeMap_PipeIndex) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use Request_PipeMap_PipeIndex.ProtoReflect.Descriptor instead.
func (*Request_PipeMap_PipeIndex) Descriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{0, 7, 0}
}
func (x *Request_PipeMap_PipeIndex) GetIndex() int32 {
if x != nil {
return x.Index
@ -790,11 +1296,35 @@ func (x *Request_PipeMap_PipeIndex) GetFd() int32 {
return 0
}
func (x *Request_PipeMap_PipeIndex) SetIndex(v int32) {
x.Index = v
}
func (x *Request_PipeMap_PipeIndex) SetFd(v int32) {
x.Fd = v
}
type Request_PipeMap_PipeIndex_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
Index int32
Fd int32
}
func (b0 Request_PipeMap_PipeIndex_builder) Build() *Request_PipeMap_PipeIndex {
m0 := &Request_PipeMap_PipeIndex{}
b, x := &b0, m0
_, _ = b, x
x.Index = b.Index
x.Fd = b.Fd
return m0
}
var File_request_proto protoreflect.FileDescriptor
const file_request_proto_rawDesc = "" +
"\n" +
"\rrequest.proto\x12\x02pb\x1a\x1bgoogle/protobuf/empty.proto\"\x8f\x0e\n" +
"\rrequest.proto\x12\x02pb\x1a\x1bgoogle/protobuf/empty.proto\x1a!google/protobuf/go_features.proto\"\x8f\x0e\n" +
"\aRequest\x12\x1c\n" +
"\trequestID\x18\x01 \x01(\tR\trequestID\x12%\n" +
"\x03cmd\x18\x02 \x03(\v2\x13.pb.Request.CmdTypeR\x03cmd\x125\n" +
@ -863,19 +1393,7 @@ const file_request_proto_rawDesc = "" +
"\x03max\x18\x05 \x01(\x04R\x03max\x1a1\n" +
"\tPipeIndex\x12\x14\n" +
"\x05index\x18\x01 \x01(\x05R\x05index\x12\x0e\n" +
"\x02fd\x18\x02 \x01(\x05R\x02fdB$Z\x1dgithub.com/criyle/go-judge/pb\x92\x03\x02\b\x02b\beditionsp\xe8\a"
var (
file_request_proto_rawDescOnce sync.Once
file_request_proto_rawDescData []byte
)
func file_request_proto_rawDescGZIP() []byte {
file_request_proto_rawDescOnce.Do(func() {
file_request_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_request_proto_rawDesc), len(file_request_proto_rawDesc)))
})
return file_request_proto_rawDescData
}
"\x02fd\x18\x02 \x01(\x05R\x02fdB)Z\x1dgithub.com/criyle/go-judge/pb\x92\x03\a\xd2>\x02\x10\x02\b\x02b\beditionsp\xe8\a"
var file_request_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
var file_request_proto_goTypes = []any{

View File

@ -4,8 +4,10 @@ package pb;
option features.field_presence = IMPLICIT;
option go_package = "github.com/criyle/go-judge/pb";
option features.(pb.go).api_level = API_HYBRID;
import "google/protobuf/empty.proto";
import "google/protobuf/go_features.proto";
message Request {
message LocalFile { string src = 1; }

1463
pb/request_protoopaque.pb.go Normal file

File diff suppressed because it is too large Load Diff

View File

@ -4,13 +4,15 @@
// protoc v6.31.1
// source: response.proto
//go:build !protoopaque
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
_ "google.golang.org/protobuf/types/gofeaturespb"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
@ -86,11 +88,6 @@ func (x Response_FileError_ErrorType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use Response_FileError_ErrorType.Descriptor instead.
func (Response_FileError_ErrorType) EnumDescriptor() ([]byte, []int) {
return file_response_proto_rawDescGZIP(), []int{0, 0, 0}
}
type Response_Result_StatusType int32
const (
@ -168,13 +165,8 @@ func (x Response_Result_StatusType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use Response_Result_StatusType.Descriptor instead.
func (Response_Result_StatusType) EnumDescriptor() ([]byte, []int) {
return file_response_proto_rawDescGZIP(), []int{0, 1, 0}
}
type Response struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"hybrid.v1"`
RequestID string `protobuf:"bytes,1,opt,name=requestID" json:"requestID,omitempty"`
Results []*Response_Result `protobuf:"bytes,2,rep,name=results" json:"results,omitempty"`
Error string `protobuf:"bytes,3,opt,name=error" json:"error,omitempty"`
@ -207,11 +199,6 @@ func (x *Response) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use Response.ProtoReflect.Descriptor instead.
func (*Response) Descriptor() ([]byte, []int) {
return file_response_proto_rawDescGZIP(), []int{0}
}
func (x *Response) GetRequestID() string {
if x != nil {
return x.RequestID
@ -233,8 +220,38 @@ func (x *Response) GetError() string {
return ""
}
func (x *Response) SetRequestID(v string) {
x.RequestID = v
}
func (x *Response) SetResults(v []*Response_Result) {
x.Results = v
}
func (x *Response) SetError(v string) {
x.Error = v
}
type Response_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
RequestID string
Results []*Response_Result
Error string
}
func (b0 Response_builder) Build() *Response {
m0 := &Response{}
b, x := &b0, m0
_, _ = b, x
x.RequestID = b.RequestID
x.Results = b.Results
x.Error = b.Error
return m0
}
type Response_FileError struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"hybrid.v1"`
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
Type Response_FileError_ErrorType `protobuf:"varint,2,opt,name=type,enum=pb.Response_FileError_ErrorType" json:"type,omitempty"`
Message string `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"`
@ -267,11 +284,6 @@ func (x *Response_FileError) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use Response_FileError.ProtoReflect.Descriptor instead.
func (*Response_FileError) Descriptor() ([]byte, []int) {
return file_response_proto_rawDescGZIP(), []int{0, 0}
}
func (x *Response_FileError) GetName() string {
if x != nil {
return x.Name
@ -293,8 +305,38 @@ func (x *Response_FileError) GetMessage() string {
return ""
}
func (x *Response_FileError) SetName(v string) {
x.Name = v
}
func (x *Response_FileError) SetType(v Response_FileError_ErrorType) {
x.Type = v
}
func (x *Response_FileError) SetMessage(v string) {
x.Message = v
}
type Response_FileError_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
Name string
Type Response_FileError_ErrorType
Message string
}
func (b0 Response_FileError_builder) Build() *Response_FileError {
m0 := &Response_FileError{}
b, x := &b0, m0
_, _ = b, x
x.Name = b.Name
x.Type = b.Type
x.Message = b.Message
return m0
}
type Response_Result struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"hybrid.v1"`
Status Response_Result_StatusType `protobuf:"varint,1,opt,name=status,enum=pb.Response_Result_StatusType" json:"status,omitempty"`
ExitStatus int32 `protobuf:"varint,2,opt,name=exitStatus" json:"exitStatus,omitempty"`
Error string `protobuf:"bytes,3,opt,name=error" json:"error,omitempty"`
@ -334,11 +376,6 @@ func (x *Response_Result) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use Response_Result.ProtoReflect.Descriptor instead.
func (*Response_Result) Descriptor() ([]byte, []int) {
return file_response_proto_rawDescGZIP(), []int{0, 1}
}
func (x *Response_Result) GetStatus() Response_Result_StatusType {
if x != nil {
return x.Status
@ -409,11 +446,83 @@ func (x *Response_Result) GetFileError() []*Response_FileError {
return nil
}
func (x *Response_Result) SetStatus(v Response_Result_StatusType) {
x.Status = v
}
func (x *Response_Result) SetExitStatus(v int32) {
x.ExitStatus = v
}
func (x *Response_Result) SetError(v string) {
x.Error = v
}
func (x *Response_Result) SetTime(v uint64) {
x.Time = v
}
func (x *Response_Result) SetRunTime(v uint64) {
x.RunTime = v
}
func (x *Response_Result) SetProcPeak(v uint64) {
x.ProcPeak = v
}
func (x *Response_Result) SetMemory(v uint64) {
x.Memory = v
}
func (x *Response_Result) SetFiles(v map[string][]byte) {
x.Files = v
}
func (x *Response_Result) SetFileIDs(v map[string]string) {
x.FileIDs = v
}
func (x *Response_Result) SetFileError(v []*Response_FileError) {
x.FileError = v
}
type Response_Result_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
Status Response_Result_StatusType
ExitStatus int32
Error string
Time uint64
RunTime uint64
ProcPeak uint64
Memory uint64
Files map[string][]byte
FileIDs map[string]string
FileError []*Response_FileError
}
func (b0 Response_Result_builder) Build() *Response_Result {
m0 := &Response_Result{}
b, x := &b0, m0
_, _ = b, x
x.Status = b.Status
x.ExitStatus = b.ExitStatus
x.Error = b.Error
x.Time = b.Time
x.RunTime = b.RunTime
x.ProcPeak = b.ProcPeak
x.Memory = b.Memory
x.Files = b.Files
x.FileIDs = b.FileIDs
x.FileError = b.FileError
return m0
}
var File_response_proto protoreflect.FileDescriptor
const file_response_proto_rawDesc = "" +
"\n" +
"\x0eresponse.proto\x12\x02pb\"\xe6\t\n" +
"\x0eresponse.proto\x12\x02pb\x1a!google/protobuf/go_features.proto\"\xe6\t\n" +
"\bResponse\x12\x1c\n" +
"\trequestID\x18\x01 \x01(\tR\trequestID\x12-\n" +
"\aresults\x18\x02 \x03(\v2\x13.pb.Response.ResultR\aresults\x12\x14\n" +
@ -470,19 +579,7 @@ const file_response_proto_rawDesc = "" +
"\x12\x13\n" +
"\x0fJudgementFailed\x10\v\x12\x16\n" +
"\x12InvalidInteraction\x10\f\x12\x11\n" +
"\rInternalError\x10\rB$Z\x1dgithub.com/criyle/go-judge/pb\x92\x03\x02\b\x02b\beditionsp\xe8\a"
var (
file_response_proto_rawDescOnce sync.Once
file_response_proto_rawDescData []byte
)
func file_response_proto_rawDescGZIP() []byte {
file_response_proto_rawDescOnce.Do(func() {
file_response_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_response_proto_rawDesc), len(file_response_proto_rawDesc)))
})
return file_response_proto_rawDescData
}
"\rInternalError\x10\rB)Z\x1dgithub.com/criyle/go-judge/pb\x92\x03\a\xd2>\x02\x10\x02\b\x02b\beditionsp\xe8\a"
var file_response_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_response_proto_msgTypes = make([]protoimpl.MessageInfo, 5)

View File

@ -1,9 +1,11 @@
edition = "2023";
package pb;
import "google/protobuf/go_features.proto";
option features.field_presence = IMPLICIT;
option go_package = "github.com/criyle/go-judge/pb";
option features.(pb.go).api_level = API_HYBRID;
message Response {
message FileError {

View File

@ -0,0 +1,636 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.6
// protoc v6.31.1
// source: response.proto
//go:build protoopaque
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
_ "google.golang.org/protobuf/types/gofeaturespb"
reflect "reflect"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type Response_FileError_ErrorType int32
const (
Response_FileError_CopyInOpenFile Response_FileError_ErrorType = 0
Response_FileError_CopyInCreateFile Response_FileError_ErrorType = 1
Response_FileError_CopyInCopyContent Response_FileError_ErrorType = 2
Response_FileError_CopyOutOpen Response_FileError_ErrorType = 3
Response_FileError_CopyOutNotRegularFile Response_FileError_ErrorType = 4
Response_FileError_CopyOutSizeExceeded Response_FileError_ErrorType = 5
Response_FileError_CopyOutCreateFile Response_FileError_ErrorType = 6
Response_FileError_CopyOutCopyContent Response_FileError_ErrorType = 7
Response_FileError_CollectSizeExceeded Response_FileError_ErrorType = 8
Response_FileError_Symlink Response_FileError_ErrorType = 9
)
// Enum value maps for Response_FileError_ErrorType.
var (
Response_FileError_ErrorType_name = map[int32]string{
0: "CopyInOpenFile",
1: "CopyInCreateFile",
2: "CopyInCopyContent",
3: "CopyOutOpen",
4: "CopyOutNotRegularFile",
5: "CopyOutSizeExceeded",
6: "CopyOutCreateFile",
7: "CopyOutCopyContent",
8: "CollectSizeExceeded",
9: "Symlink",
}
Response_FileError_ErrorType_value = map[string]int32{
"CopyInOpenFile": 0,
"CopyInCreateFile": 1,
"CopyInCopyContent": 2,
"CopyOutOpen": 3,
"CopyOutNotRegularFile": 4,
"CopyOutSizeExceeded": 5,
"CopyOutCreateFile": 6,
"CopyOutCopyContent": 7,
"CollectSizeExceeded": 8,
"Symlink": 9,
}
)
func (x Response_FileError_ErrorType) Enum() *Response_FileError_ErrorType {
p := new(Response_FileError_ErrorType)
*p = x
return p
}
func (x Response_FileError_ErrorType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (Response_FileError_ErrorType) Descriptor() protoreflect.EnumDescriptor {
return file_response_proto_enumTypes[0].Descriptor()
}
func (Response_FileError_ErrorType) Type() protoreflect.EnumType {
return &file_response_proto_enumTypes[0]
}
func (x Response_FileError_ErrorType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
type Response_Result_StatusType int32
const (
Response_Result_Invalid Response_Result_StatusType = 0
Response_Result_Accepted Response_Result_StatusType = 1
Response_Result_WrongAnswer Response_Result_StatusType = 2 // Not used
Response_Result_PartiallyCorrect Response_Result_StatusType = 3 // Not used
Response_Result_MemoryLimitExceeded Response_Result_StatusType = 4
Response_Result_TimeLimitExceeded Response_Result_StatusType = 5
Response_Result_OutputLimitExceeded Response_Result_StatusType = 6
Response_Result_FileError Response_Result_StatusType = 7
Response_Result_NonZeroExitStatus Response_Result_StatusType = 8
Response_Result_Signalled Response_Result_StatusType = 9
Response_Result_DangerousSyscall Response_Result_StatusType = 10
Response_Result_JudgementFailed Response_Result_StatusType = 11 // Not used
Response_Result_InvalidInteraction Response_Result_StatusType = 12 // Not used
Response_Result_InternalError Response_Result_StatusType = 13
)
// Enum value maps for Response_Result_StatusType.
var (
Response_Result_StatusType_name = map[int32]string{
0: "Invalid",
1: "Accepted",
2: "WrongAnswer",
3: "PartiallyCorrect",
4: "MemoryLimitExceeded",
5: "TimeLimitExceeded",
6: "OutputLimitExceeded",
7: "FileError",
8: "NonZeroExitStatus",
9: "Signalled",
10: "DangerousSyscall",
11: "JudgementFailed",
12: "InvalidInteraction",
13: "InternalError",
}
Response_Result_StatusType_value = map[string]int32{
"Invalid": 0,
"Accepted": 1,
"WrongAnswer": 2,
"PartiallyCorrect": 3,
"MemoryLimitExceeded": 4,
"TimeLimitExceeded": 5,
"OutputLimitExceeded": 6,
"FileError": 7,
"NonZeroExitStatus": 8,
"Signalled": 9,
"DangerousSyscall": 10,
"JudgementFailed": 11,
"InvalidInteraction": 12,
"InternalError": 13,
}
)
func (x Response_Result_StatusType) Enum() *Response_Result_StatusType {
p := new(Response_Result_StatusType)
*p = x
return p
}
func (x Response_Result_StatusType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (Response_Result_StatusType) Descriptor() protoreflect.EnumDescriptor {
return file_response_proto_enumTypes[1].Descriptor()
}
func (Response_Result_StatusType) Type() protoreflect.EnumType {
return &file_response_proto_enumTypes[1]
}
func (x Response_Result_StatusType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
type Response struct {
state protoimpl.MessageState `protogen:"opaque.v1"`
xxx_hidden_RequestID string `protobuf:"bytes,1,opt,name=requestID"`
xxx_hidden_Results *[]*Response_Result `protobuf:"bytes,2,rep,name=results"`
xxx_hidden_Error string `protobuf:"bytes,3,opt,name=error"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Response) Reset() {
*x = Response{}
mi := &file_response_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Response) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Response) ProtoMessage() {}
func (x *Response) ProtoReflect() protoreflect.Message {
mi := &file_response_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *Response) GetRequestID() string {
if x != nil {
return x.xxx_hidden_RequestID
}
return ""
}
func (x *Response) GetResults() []*Response_Result {
if x != nil {
if x.xxx_hidden_Results != nil {
return *x.xxx_hidden_Results
}
}
return nil
}
func (x *Response) GetError() string {
if x != nil {
return x.xxx_hidden_Error
}
return ""
}
func (x *Response) SetRequestID(v string) {
x.xxx_hidden_RequestID = v
}
func (x *Response) SetResults(v []*Response_Result) {
x.xxx_hidden_Results = &v
}
func (x *Response) SetError(v string) {
x.xxx_hidden_Error = v
}
type Response_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
RequestID string
Results []*Response_Result
Error string
}
func (b0 Response_builder) Build() *Response {
m0 := &Response{}
b, x := &b0, m0
_, _ = b, x
x.xxx_hidden_RequestID = b.RequestID
x.xxx_hidden_Results = &b.Results
x.xxx_hidden_Error = b.Error
return m0
}
type Response_FileError struct {
state protoimpl.MessageState `protogen:"opaque.v1"`
xxx_hidden_Name string `protobuf:"bytes,1,opt,name=name"`
xxx_hidden_Type Response_FileError_ErrorType `protobuf:"varint,2,opt,name=type,enum=pb.Response_FileError_ErrorType"`
xxx_hidden_Message string `protobuf:"bytes,3,opt,name=message"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Response_FileError) Reset() {
*x = Response_FileError{}
mi := &file_response_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Response_FileError) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Response_FileError) ProtoMessage() {}
func (x *Response_FileError) ProtoReflect() protoreflect.Message {
mi := &file_response_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *Response_FileError) GetName() string {
if x != nil {
return x.xxx_hidden_Name
}
return ""
}
func (x *Response_FileError) GetType() Response_FileError_ErrorType {
if x != nil {
return x.xxx_hidden_Type
}
return Response_FileError_CopyInOpenFile
}
func (x *Response_FileError) GetMessage() string {
if x != nil {
return x.xxx_hidden_Message
}
return ""
}
func (x *Response_FileError) SetName(v string) {
x.xxx_hidden_Name = v
}
func (x *Response_FileError) SetType(v Response_FileError_ErrorType) {
x.xxx_hidden_Type = v
}
func (x *Response_FileError) SetMessage(v string) {
x.xxx_hidden_Message = v
}
type Response_FileError_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
Name string
Type Response_FileError_ErrorType
Message string
}
func (b0 Response_FileError_builder) Build() *Response_FileError {
m0 := &Response_FileError{}
b, x := &b0, m0
_, _ = b, x
x.xxx_hidden_Name = b.Name
x.xxx_hidden_Type = b.Type
x.xxx_hidden_Message = b.Message
return m0
}
type Response_Result struct {
state protoimpl.MessageState `protogen:"opaque.v1"`
xxx_hidden_Status Response_Result_StatusType `protobuf:"varint,1,opt,name=status,enum=pb.Response_Result_StatusType"`
xxx_hidden_ExitStatus int32 `protobuf:"varint,2,opt,name=exitStatus"`
xxx_hidden_Error string `protobuf:"bytes,3,opt,name=error"`
xxx_hidden_Time uint64 `protobuf:"varint,4,opt,name=time"`
xxx_hidden_RunTime uint64 `protobuf:"varint,8,opt,name=runTime"`
xxx_hidden_ProcPeak uint64 `protobuf:"varint,10,opt,name=procPeak"`
xxx_hidden_Memory uint64 `protobuf:"varint,5,opt,name=memory"`
xxx_hidden_Files map[string][]byte `protobuf:"bytes,6,rep,name=files" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
xxx_hidden_FileIDs map[string]string `protobuf:"bytes,7,rep,name=fileIDs" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
xxx_hidden_FileError *[]*Response_FileError `protobuf:"bytes,9,rep,name=fileError"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Response_Result) Reset() {
*x = Response_Result{}
mi := &file_response_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Response_Result) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Response_Result) ProtoMessage() {}
func (x *Response_Result) ProtoReflect() protoreflect.Message {
mi := &file_response_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *Response_Result) GetStatus() Response_Result_StatusType {
if x != nil {
return x.xxx_hidden_Status
}
return Response_Result_Invalid
}
func (x *Response_Result) GetExitStatus() int32 {
if x != nil {
return x.xxx_hidden_ExitStatus
}
return 0
}
func (x *Response_Result) GetError() string {
if x != nil {
return x.xxx_hidden_Error
}
return ""
}
func (x *Response_Result) GetTime() uint64 {
if x != nil {
return x.xxx_hidden_Time
}
return 0
}
func (x *Response_Result) GetRunTime() uint64 {
if x != nil {
return x.xxx_hidden_RunTime
}
return 0
}
func (x *Response_Result) GetProcPeak() uint64 {
if x != nil {
return x.xxx_hidden_ProcPeak
}
return 0
}
func (x *Response_Result) GetMemory() uint64 {
if x != nil {
return x.xxx_hidden_Memory
}
return 0
}
func (x *Response_Result) GetFiles() map[string][]byte {
if x != nil {
return x.xxx_hidden_Files
}
return nil
}
func (x *Response_Result) GetFileIDs() map[string]string {
if x != nil {
return x.xxx_hidden_FileIDs
}
return nil
}
func (x *Response_Result) GetFileError() []*Response_FileError {
if x != nil {
if x.xxx_hidden_FileError != nil {
return *x.xxx_hidden_FileError
}
}
return nil
}
func (x *Response_Result) SetStatus(v Response_Result_StatusType) {
x.xxx_hidden_Status = v
}
func (x *Response_Result) SetExitStatus(v int32) {
x.xxx_hidden_ExitStatus = v
}
func (x *Response_Result) SetError(v string) {
x.xxx_hidden_Error = v
}
func (x *Response_Result) SetTime(v uint64) {
x.xxx_hidden_Time = v
}
func (x *Response_Result) SetRunTime(v uint64) {
x.xxx_hidden_RunTime = v
}
func (x *Response_Result) SetProcPeak(v uint64) {
x.xxx_hidden_ProcPeak = v
}
func (x *Response_Result) SetMemory(v uint64) {
x.xxx_hidden_Memory = v
}
func (x *Response_Result) SetFiles(v map[string][]byte) {
x.xxx_hidden_Files = v
}
func (x *Response_Result) SetFileIDs(v map[string]string) {
x.xxx_hidden_FileIDs = v
}
func (x *Response_Result) SetFileError(v []*Response_FileError) {
x.xxx_hidden_FileError = &v
}
type Response_Result_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
Status Response_Result_StatusType
ExitStatus int32
Error string
Time uint64
RunTime uint64
ProcPeak uint64
Memory uint64
Files map[string][]byte
FileIDs map[string]string
FileError []*Response_FileError
}
func (b0 Response_Result_builder) Build() *Response_Result {
m0 := &Response_Result{}
b, x := &b0, m0
_, _ = b, x
x.xxx_hidden_Status = b.Status
x.xxx_hidden_ExitStatus = b.ExitStatus
x.xxx_hidden_Error = b.Error
x.xxx_hidden_Time = b.Time
x.xxx_hidden_RunTime = b.RunTime
x.xxx_hidden_ProcPeak = b.ProcPeak
x.xxx_hidden_Memory = b.Memory
x.xxx_hidden_Files = b.Files
x.xxx_hidden_FileIDs = b.FileIDs
x.xxx_hidden_FileError = &b.FileError
return m0
}
var File_response_proto protoreflect.FileDescriptor
const file_response_proto_rawDesc = "" +
"\n" +
"\x0eresponse.proto\x12\x02pb\x1a!google/protobuf/go_features.proto\"\xe6\t\n" +
"\bResponse\x12\x1c\n" +
"\trequestID\x18\x01 \x01(\tR\trequestID\x12-\n" +
"\aresults\x18\x02 \x03(\v2\x13.pb.Response.ResultR\aresults\x12\x14\n" +
"\x05error\x18\x03 \x01(\tR\x05error\x1a\xd8\x02\n" +
"\tFileError\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x124\n" +
"\x04type\x18\x02 \x01(\x0e2 .pb.Response.FileError.ErrorTypeR\x04type\x12\x18\n" +
"\amessage\x18\x03 \x01(\tR\amessage\"\xe6\x01\n" +
"\tErrorType\x12\x12\n" +
"\x0eCopyInOpenFile\x10\x00\x12\x14\n" +
"\x10CopyInCreateFile\x10\x01\x12\x15\n" +
"\x11CopyInCopyContent\x10\x02\x12\x0f\n" +
"\vCopyOutOpen\x10\x03\x12\x19\n" +
"\x15CopyOutNotRegularFile\x10\x04\x12\x17\n" +
"\x13CopyOutSizeExceeded\x10\x05\x12\x15\n" +
"\x11CopyOutCreateFile\x10\x06\x12\x16\n" +
"\x12CopyOutCopyContent\x10\a\x12\x17\n" +
"\x13CollectSizeExceeded\x10\b\x12\v\n" +
"\aSymlink\x10\t\x1a\x9b\x06\n" +
"\x06Result\x126\n" +
"\x06status\x18\x01 \x01(\x0e2\x1e.pb.Response.Result.StatusTypeR\x06status\x12\x1e\n" +
"\n" +
"exitStatus\x18\x02 \x01(\x05R\n" +
"exitStatus\x12\x14\n" +
"\x05error\x18\x03 \x01(\tR\x05error\x12\x12\n" +
"\x04time\x18\x04 \x01(\x04R\x04time\x12\x18\n" +
"\arunTime\x18\b \x01(\x04R\arunTime\x12\x1a\n" +
"\bprocPeak\x18\n" +
" \x01(\x04R\bprocPeak\x12\x16\n" +
"\x06memory\x18\x05 \x01(\x04R\x06memory\x124\n" +
"\x05files\x18\x06 \x03(\v2\x1e.pb.Response.Result.FilesEntryR\x05files\x12:\n" +
"\afileIDs\x18\a \x03(\v2 .pb.Response.Result.FileIDsEntryR\afileIDs\x124\n" +
"\tfileError\x18\t \x03(\v2\x16.pb.Response.FileErrorR\tfileError\x1a8\n" +
"\n" +
"FilesEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\fR\x05value:\x028\x01\x1a:\n" +
"\fFileIDsEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xa2\x02\n" +
"\n" +
"StatusType\x12\v\n" +
"\aInvalid\x10\x00\x12\f\n" +
"\bAccepted\x10\x01\x12\x0f\n" +
"\vWrongAnswer\x10\x02\x12\x14\n" +
"\x10PartiallyCorrect\x10\x03\x12\x17\n" +
"\x13MemoryLimitExceeded\x10\x04\x12\x15\n" +
"\x11TimeLimitExceeded\x10\x05\x12\x17\n" +
"\x13OutputLimitExceeded\x10\x06\x12\r\n" +
"\tFileError\x10\a\x12\x15\n" +
"\x11NonZeroExitStatus\x10\b\x12\r\n" +
"\tSignalled\x10\t\x12\x14\n" +
"\x10DangerousSyscall\x10\n" +
"\x12\x13\n" +
"\x0fJudgementFailed\x10\v\x12\x16\n" +
"\x12InvalidInteraction\x10\f\x12\x11\n" +
"\rInternalError\x10\rB)Z\x1dgithub.com/criyle/go-judge/pb\x92\x03\a\xd2>\x02\x10\x02\b\x02b\beditionsp\xe8\a"
var file_response_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_response_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_response_proto_goTypes = []any{
(Response_FileError_ErrorType)(0), // 0: pb.Response.FileError.ErrorType
(Response_Result_StatusType)(0), // 1: pb.Response.Result.StatusType
(*Response)(nil), // 2: pb.Response
(*Response_FileError)(nil), // 3: pb.Response.FileError
(*Response_Result)(nil), // 4: pb.Response.Result
nil, // 5: pb.Response.Result.FilesEntry
nil, // 6: pb.Response.Result.FileIDsEntry
}
var file_response_proto_depIdxs = []int32{
4, // 0: pb.Response.results:type_name -> pb.Response.Result
0, // 1: pb.Response.FileError.type:type_name -> pb.Response.FileError.ErrorType
1, // 2: pb.Response.Result.status:type_name -> pb.Response.Result.StatusType
5, // 3: pb.Response.Result.files:type_name -> pb.Response.Result.FilesEntry
6, // 4: pb.Response.Result.fileIDs:type_name -> pb.Response.Result.FileIDsEntry
3, // 5: pb.Response.Result.fileError:type_name -> pb.Response.FileError
6, // [6:6] is the sub-list for method output_type
6, // [6:6] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
}
func init() { file_response_proto_init() }
func file_response_proto_init() {
if File_response_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_response_proto_rawDesc), len(file_response_proto_rawDesc)),
NumEnums: 2,
NumMessages: 5,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_response_proto_goTypes,
DependencyIndexes: file_response_proto_depIdxs,
EnumInfos: file_response_proto_enumTypes,
MessageInfos: file_response_proto_msgTypes,
}.Build()
File_response_proto = out.File
file_response_proto_goTypes = nil
file_response_proto_depIdxs = nil
}

View File

@ -4,14 +4,16 @@
// protoc v6.31.1
// source: stream_request.proto
//go:build !protoopaque
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
_ "google.golang.org/protobuf/types/gofeaturespb"
emptypb "google.golang.org/protobuf/types/known/emptypb"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
@ -23,7 +25,7 @@ const (
)
type StreamRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"hybrid.v1"`
// Types that are valid to be assigned to Request:
//
// *StreamRequest_ExecRequest
@ -60,11 +62,6 @@ func (x *StreamRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use StreamRequest.ProtoReflect.Descriptor instead.
func (*StreamRequest) Descriptor() ([]byte, []int) {
return file_stream_request_proto_rawDescGZIP(), []int{0}
}
func (x *StreamRequest) GetRequest() isStreamRequest_Request {
if x != nil {
return x.Request
@ -108,6 +105,169 @@ func (x *StreamRequest) GetExecCancel() *emptypb.Empty {
return nil
}
func (x *StreamRequest) SetExecRequest(v *Request) {
if v == nil {
x.Request = nil
return
}
x.Request = &StreamRequest_ExecRequest{v}
}
func (x *StreamRequest) SetExecInput(v *StreamRequest_Input) {
if v == nil {
x.Request = nil
return
}
x.Request = &StreamRequest_ExecInput{v}
}
func (x *StreamRequest) SetExecResize(v *StreamRequest_Resize) {
if v == nil {
x.Request = nil
return
}
x.Request = &StreamRequest_ExecResize{v}
}
func (x *StreamRequest) SetExecCancel(v *emptypb.Empty) {
if v == nil {
x.Request = nil
return
}
x.Request = &StreamRequest_ExecCancel{v}
}
func (x *StreamRequest) HasRequest() bool {
if x == nil {
return false
}
return x.Request != nil
}
func (x *StreamRequest) HasExecRequest() bool {
if x == nil {
return false
}
_, ok := x.Request.(*StreamRequest_ExecRequest)
return ok
}
func (x *StreamRequest) HasExecInput() bool {
if x == nil {
return false
}
_, ok := x.Request.(*StreamRequest_ExecInput)
return ok
}
func (x *StreamRequest) HasExecResize() bool {
if x == nil {
return false
}
_, ok := x.Request.(*StreamRequest_ExecResize)
return ok
}
func (x *StreamRequest) HasExecCancel() bool {
if x == nil {
return false
}
_, ok := x.Request.(*StreamRequest_ExecCancel)
return ok
}
func (x *StreamRequest) ClearRequest() {
x.Request = nil
}
func (x *StreamRequest) ClearExecRequest() {
if _, ok := x.Request.(*StreamRequest_ExecRequest); ok {
x.Request = nil
}
}
func (x *StreamRequest) ClearExecInput() {
if _, ok := x.Request.(*StreamRequest_ExecInput); ok {
x.Request = nil
}
}
func (x *StreamRequest) ClearExecResize() {
if _, ok := x.Request.(*StreamRequest_ExecResize); ok {
x.Request = nil
}
}
func (x *StreamRequest) ClearExecCancel() {
if _, ok := x.Request.(*StreamRequest_ExecCancel); ok {
x.Request = nil
}
}
const StreamRequest_Request_not_set_case case_StreamRequest_Request = 0
const StreamRequest_ExecRequest_case case_StreamRequest_Request = 1
const StreamRequest_ExecInput_case case_StreamRequest_Request = 2
const StreamRequest_ExecResize_case case_StreamRequest_Request = 3
const StreamRequest_ExecCancel_case case_StreamRequest_Request = 4
func (x *StreamRequest) WhichRequest() case_StreamRequest_Request {
if x == nil {
return StreamRequest_Request_not_set_case
}
switch x.Request.(type) {
case *StreamRequest_ExecRequest:
return StreamRequest_ExecRequest_case
case *StreamRequest_ExecInput:
return StreamRequest_ExecInput_case
case *StreamRequest_ExecResize:
return StreamRequest_ExecResize_case
case *StreamRequest_ExecCancel:
return StreamRequest_ExecCancel_case
default:
return StreamRequest_Request_not_set_case
}
}
type StreamRequest_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Fields of oneof Request:
ExecRequest *Request
ExecInput *StreamRequest_Input
ExecResize *StreamRequest_Resize
ExecCancel *emptypb.Empty
// -- end of Request
}
func (b0 StreamRequest_builder) Build() *StreamRequest {
m0 := &StreamRequest{}
b, x := &b0, m0
_, _ = b, x
if b.ExecRequest != nil {
x.Request = &StreamRequest_ExecRequest{b.ExecRequest}
}
if b.ExecInput != nil {
x.Request = &StreamRequest_ExecInput{b.ExecInput}
}
if b.ExecResize != nil {
x.Request = &StreamRequest_ExecResize{b.ExecResize}
}
if b.ExecCancel != nil {
x.Request = &StreamRequest_ExecCancel{b.ExecCancel}
}
return m0
}
type case_StreamRequest_Request protoreflect.FieldNumber
func (x case_StreamRequest_Request) String() string {
md := file_stream_request_proto_msgTypes[0].Descriptor()
if x == 0 {
return "not set"
}
return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x))
}
type isStreamRequest_Request interface {
isStreamRequest_Request()
}
@ -137,7 +297,7 @@ func (*StreamRequest_ExecResize) isStreamRequest_Request() {}
func (*StreamRequest_ExecCancel) isStreamRequest_Request() {}
type StreamRequest_Input struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"hybrid.v1"`
Index uint32 `protobuf:"varint,1,opt,name=index" json:"index,omitempty"`
Fd uint32 `protobuf:"varint,3,opt,name=fd" json:"fd,omitempty"`
Content []byte `protobuf:"bytes,2,opt,name=content" json:"content,omitempty"`
@ -170,11 +330,6 @@ func (x *StreamRequest_Input) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use StreamRequest_Input.ProtoReflect.Descriptor instead.
func (*StreamRequest_Input) Descriptor() ([]byte, []int) {
return file_stream_request_proto_rawDescGZIP(), []int{0, 0}
}
func (x *StreamRequest_Input) GetIndex() uint32 {
if x != nil {
return x.Index
@ -196,8 +351,41 @@ func (x *StreamRequest_Input) GetContent() []byte {
return nil
}
func (x *StreamRequest_Input) SetIndex(v uint32) {
x.Index = v
}
func (x *StreamRequest_Input) SetFd(v uint32) {
x.Fd = v
}
func (x *StreamRequest_Input) SetContent(v []byte) {
if v == nil {
v = []byte{}
}
x.Content = v
}
type StreamRequest_Input_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
Index uint32
Fd uint32
Content []byte
}
func (b0 StreamRequest_Input_builder) Build() *StreamRequest_Input {
m0 := &StreamRequest_Input{}
b, x := &b0, m0
_, _ = b, x
x.Index = b.Index
x.Fd = b.Fd
x.Content = b.Content
return m0
}
type StreamRequest_Resize struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"hybrid.v1"`
Index uint32 `protobuf:"varint,1,opt,name=index" json:"index,omitempty"`
Fd uint32 `protobuf:"varint,6,opt,name=fd" json:"fd,omitempty"`
Rows uint32 `protobuf:"varint,2,opt,name=rows" json:"rows,omitempty"`
@ -233,11 +421,6 @@ func (x *StreamRequest_Resize) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use StreamRequest_Resize.ProtoReflect.Descriptor instead.
func (*StreamRequest_Resize) Descriptor() ([]byte, []int) {
return file_stream_request_proto_rawDescGZIP(), []int{0, 1}
}
func (x *StreamRequest_Resize) GetIndex() uint32 {
if x != nil {
return x.Index
@ -280,11 +463,59 @@ func (x *StreamRequest_Resize) GetY() uint32 {
return 0
}
func (x *StreamRequest_Resize) SetIndex(v uint32) {
x.Index = v
}
func (x *StreamRequest_Resize) SetFd(v uint32) {
x.Fd = v
}
func (x *StreamRequest_Resize) SetRows(v uint32) {
x.Rows = v
}
func (x *StreamRequest_Resize) SetCols(v uint32) {
x.Cols = v
}
func (x *StreamRequest_Resize) SetX(v uint32) {
x.X = v
}
func (x *StreamRequest_Resize) SetY(v uint32) {
x.Y = v
}
type StreamRequest_Resize_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
Index uint32
Fd uint32
Rows uint32
Cols uint32
X uint32
Y uint32
}
func (b0 StreamRequest_Resize_builder) Build() *StreamRequest_Resize {
m0 := &StreamRequest_Resize{}
b, x := &b0, m0
_, _ = b, x
x.Index = b.Index
x.Fd = b.Fd
x.Rows = b.Rows
x.Cols = b.Cols
x.X = b.X
x.Y = b.Y
return m0
}
var File_stream_request_proto protoreflect.FileDescriptor
const file_stream_request_proto_rawDesc = "" +
"\n" +
"\x14stream_request.proto\x12\x02pb\x1a\x1bgoogle/protobuf/empty.proto\x1a\rrequest.proto\"\xb7\x03\n" +
"\x14stream_request.proto\x12\x02pb\x1a\x1bgoogle/protobuf/empty.proto\x1a\rrequest.proto\x1a!google/protobuf/go_features.proto\"\xb7\x03\n" +
"\rStreamRequest\x12/\n" +
"\vexecRequest\x18\x01 \x01(\v2\v.pb.RequestH\x00R\vexecRequest\x127\n" +
"\texecInput\x18\x02 \x01(\v2\x17.pb.StreamRequest.InputH\x00R\texecInput\x12:\n" +
@ -305,19 +536,7 @@ const file_stream_request_proto_rawDesc = "" +
"\x04cols\x18\x03 \x01(\rR\x04cols\x12\f\n" +
"\x01x\x18\x04 \x01(\rR\x01x\x12\f\n" +
"\x01y\x18\x05 \x01(\rR\x01yB\t\n" +
"\arequestB$Z\x1dgithub.com/criyle/go-judge/pb\x92\x03\x02\b\x02b\beditionsp\xe8\a"
var (
file_stream_request_proto_rawDescOnce sync.Once
file_stream_request_proto_rawDescData []byte
)
func file_stream_request_proto_rawDescGZIP() []byte {
file_stream_request_proto_rawDescOnce.Do(func() {
file_stream_request_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_stream_request_proto_rawDesc), len(file_stream_request_proto_rawDesc)))
})
return file_stream_request_proto_rawDescData
}
"\arequestB)Z\x1dgithub.com/criyle/go-judge/pb\x92\x03\a\xd2>\x02\x10\x02\b\x02b\beditionsp\xe8\a"
var file_stream_request_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_stream_request_proto_goTypes = []any{

View File

@ -4,9 +4,11 @@ package pb;
option features.field_presence = IMPLICIT;
option go_package = "github.com/criyle/go-judge/pb";
option features.(pb.go).api_level = API_HYBRID;
import "google/protobuf/empty.proto";
import "request.proto";
import "google/protobuf/go_features.proto";
message StreamRequest {
message Input {

View File

@ -0,0 +1,577 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.6
// protoc v6.31.1
// source: stream_request.proto
//go:build protoopaque
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
_ "google.golang.org/protobuf/types/gofeaturespb"
emptypb "google.golang.org/protobuf/types/known/emptypb"
reflect "reflect"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type StreamRequest struct {
state protoimpl.MessageState `protogen:"opaque.v1"`
xxx_hidden_Request isStreamRequest_Request `protobuf_oneof:"request"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *StreamRequest) Reset() {
*x = StreamRequest{}
mi := &file_stream_request_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *StreamRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StreamRequest) ProtoMessage() {}
func (x *StreamRequest) ProtoReflect() protoreflect.Message {
mi := &file_stream_request_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *StreamRequest) GetExecRequest() *Request {
if x != nil {
if x, ok := x.xxx_hidden_Request.(*streamRequest_ExecRequest); ok {
return x.ExecRequest
}
}
return nil
}
func (x *StreamRequest) GetExecInput() *StreamRequest_Input {
if x != nil {
if x, ok := x.xxx_hidden_Request.(*streamRequest_ExecInput); ok {
return x.ExecInput
}
}
return nil
}
func (x *StreamRequest) GetExecResize() *StreamRequest_Resize {
if x != nil {
if x, ok := x.xxx_hidden_Request.(*streamRequest_ExecResize); ok {
return x.ExecResize
}
}
return nil
}
func (x *StreamRequest) GetExecCancel() *emptypb.Empty {
if x != nil {
if x, ok := x.xxx_hidden_Request.(*streamRequest_ExecCancel); ok {
return x.ExecCancel
}
}
return nil
}
func (x *StreamRequest) SetExecRequest(v *Request) {
if v == nil {
x.xxx_hidden_Request = nil
return
}
x.xxx_hidden_Request = &streamRequest_ExecRequest{v}
}
func (x *StreamRequest) SetExecInput(v *StreamRequest_Input) {
if v == nil {
x.xxx_hidden_Request = nil
return
}
x.xxx_hidden_Request = &streamRequest_ExecInput{v}
}
func (x *StreamRequest) SetExecResize(v *StreamRequest_Resize) {
if v == nil {
x.xxx_hidden_Request = nil
return
}
x.xxx_hidden_Request = &streamRequest_ExecResize{v}
}
func (x *StreamRequest) SetExecCancel(v *emptypb.Empty) {
if v == nil {
x.xxx_hidden_Request = nil
return
}
x.xxx_hidden_Request = &streamRequest_ExecCancel{v}
}
func (x *StreamRequest) HasRequest() bool {
if x == nil {
return false
}
return x.xxx_hidden_Request != nil
}
func (x *StreamRequest) HasExecRequest() bool {
if x == nil {
return false
}
_, ok := x.xxx_hidden_Request.(*streamRequest_ExecRequest)
return ok
}
func (x *StreamRequest) HasExecInput() bool {
if x == nil {
return false
}
_, ok := x.xxx_hidden_Request.(*streamRequest_ExecInput)
return ok
}
func (x *StreamRequest) HasExecResize() bool {
if x == nil {
return false
}
_, ok := x.xxx_hidden_Request.(*streamRequest_ExecResize)
return ok
}
func (x *StreamRequest) HasExecCancel() bool {
if x == nil {
return false
}
_, ok := x.xxx_hidden_Request.(*streamRequest_ExecCancel)
return ok
}
func (x *StreamRequest) ClearRequest() {
x.xxx_hidden_Request = nil
}
func (x *StreamRequest) ClearExecRequest() {
if _, ok := x.xxx_hidden_Request.(*streamRequest_ExecRequest); ok {
x.xxx_hidden_Request = nil
}
}
func (x *StreamRequest) ClearExecInput() {
if _, ok := x.xxx_hidden_Request.(*streamRequest_ExecInput); ok {
x.xxx_hidden_Request = nil
}
}
func (x *StreamRequest) ClearExecResize() {
if _, ok := x.xxx_hidden_Request.(*streamRequest_ExecResize); ok {
x.xxx_hidden_Request = nil
}
}
func (x *StreamRequest) ClearExecCancel() {
if _, ok := x.xxx_hidden_Request.(*streamRequest_ExecCancel); ok {
x.xxx_hidden_Request = nil
}
}
const StreamRequest_Request_not_set_case case_StreamRequest_Request = 0
const StreamRequest_ExecRequest_case case_StreamRequest_Request = 1
const StreamRequest_ExecInput_case case_StreamRequest_Request = 2
const StreamRequest_ExecResize_case case_StreamRequest_Request = 3
const StreamRequest_ExecCancel_case case_StreamRequest_Request = 4
func (x *StreamRequest) WhichRequest() case_StreamRequest_Request {
if x == nil {
return StreamRequest_Request_not_set_case
}
switch x.xxx_hidden_Request.(type) {
case *streamRequest_ExecRequest:
return StreamRequest_ExecRequest_case
case *streamRequest_ExecInput:
return StreamRequest_ExecInput_case
case *streamRequest_ExecResize:
return StreamRequest_ExecResize_case
case *streamRequest_ExecCancel:
return StreamRequest_ExecCancel_case
default:
return StreamRequest_Request_not_set_case
}
}
type StreamRequest_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Fields of oneof xxx_hidden_Request:
ExecRequest *Request
ExecInput *StreamRequest_Input
ExecResize *StreamRequest_Resize
ExecCancel *emptypb.Empty
// -- end of xxx_hidden_Request
}
func (b0 StreamRequest_builder) Build() *StreamRequest {
m0 := &StreamRequest{}
b, x := &b0, m0
_, _ = b, x
if b.ExecRequest != nil {
x.xxx_hidden_Request = &streamRequest_ExecRequest{b.ExecRequest}
}
if b.ExecInput != nil {
x.xxx_hidden_Request = &streamRequest_ExecInput{b.ExecInput}
}
if b.ExecResize != nil {
x.xxx_hidden_Request = &streamRequest_ExecResize{b.ExecResize}
}
if b.ExecCancel != nil {
x.xxx_hidden_Request = &streamRequest_ExecCancel{b.ExecCancel}
}
return m0
}
type case_StreamRequest_Request protoreflect.FieldNumber
func (x case_StreamRequest_Request) String() string {
md := file_stream_request_proto_msgTypes[0].Descriptor()
if x == 0 {
return "not set"
}
return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x))
}
type isStreamRequest_Request interface {
isStreamRequest_Request()
}
type streamRequest_ExecRequest struct {
ExecRequest *Request `protobuf:"bytes,1,opt,name=execRequest,oneof"`
}
type streamRequest_ExecInput struct {
ExecInput *StreamRequest_Input `protobuf:"bytes,2,opt,name=execInput,oneof"`
}
type streamRequest_ExecResize struct {
ExecResize *StreamRequest_Resize `protobuf:"bytes,3,opt,name=execResize,oneof"`
}
type streamRequest_ExecCancel struct {
ExecCancel *emptypb.Empty `protobuf:"bytes,4,opt,name=execCancel,oneof"`
}
func (*streamRequest_ExecRequest) isStreamRequest_Request() {}
func (*streamRequest_ExecInput) isStreamRequest_Request() {}
func (*streamRequest_ExecResize) isStreamRequest_Request() {}
func (*streamRequest_ExecCancel) isStreamRequest_Request() {}
type StreamRequest_Input struct {
state protoimpl.MessageState `protogen:"opaque.v1"`
xxx_hidden_Index uint32 `protobuf:"varint,1,opt,name=index"`
xxx_hidden_Fd uint32 `protobuf:"varint,3,opt,name=fd"`
xxx_hidden_Content []byte `protobuf:"bytes,2,opt,name=content"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *StreamRequest_Input) Reset() {
*x = StreamRequest_Input{}
mi := &file_stream_request_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *StreamRequest_Input) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StreamRequest_Input) ProtoMessage() {}
func (x *StreamRequest_Input) ProtoReflect() protoreflect.Message {
mi := &file_stream_request_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *StreamRequest_Input) GetIndex() uint32 {
if x != nil {
return x.xxx_hidden_Index
}
return 0
}
func (x *StreamRequest_Input) GetFd() uint32 {
if x != nil {
return x.xxx_hidden_Fd
}
return 0
}
func (x *StreamRequest_Input) GetContent() []byte {
if x != nil {
return x.xxx_hidden_Content
}
return nil
}
func (x *StreamRequest_Input) SetIndex(v uint32) {
x.xxx_hidden_Index = v
}
func (x *StreamRequest_Input) SetFd(v uint32) {
x.xxx_hidden_Fd = v
}
func (x *StreamRequest_Input) SetContent(v []byte) {
if v == nil {
v = []byte{}
}
x.xxx_hidden_Content = v
}
type StreamRequest_Input_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
Index uint32
Fd uint32
Content []byte
}
func (b0 StreamRequest_Input_builder) Build() *StreamRequest_Input {
m0 := &StreamRequest_Input{}
b, x := &b0, m0
_, _ = b, x
x.xxx_hidden_Index = b.Index
x.xxx_hidden_Fd = b.Fd
x.xxx_hidden_Content = b.Content
return m0
}
type StreamRequest_Resize struct {
state protoimpl.MessageState `protogen:"opaque.v1"`
xxx_hidden_Index uint32 `protobuf:"varint,1,opt,name=index"`
xxx_hidden_Fd uint32 `protobuf:"varint,6,opt,name=fd"`
xxx_hidden_Rows uint32 `protobuf:"varint,2,opt,name=rows"`
xxx_hidden_Cols uint32 `protobuf:"varint,3,opt,name=cols"`
xxx_hidden_X uint32 `protobuf:"varint,4,opt,name=x"`
xxx_hidden_Y uint32 `protobuf:"varint,5,opt,name=y"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *StreamRequest_Resize) Reset() {
*x = StreamRequest_Resize{}
mi := &file_stream_request_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *StreamRequest_Resize) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StreamRequest_Resize) ProtoMessage() {}
func (x *StreamRequest_Resize) ProtoReflect() protoreflect.Message {
mi := &file_stream_request_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *StreamRequest_Resize) GetIndex() uint32 {
if x != nil {
return x.xxx_hidden_Index
}
return 0
}
func (x *StreamRequest_Resize) GetFd() uint32 {
if x != nil {
return x.xxx_hidden_Fd
}
return 0
}
func (x *StreamRequest_Resize) GetRows() uint32 {
if x != nil {
return x.xxx_hidden_Rows
}
return 0
}
func (x *StreamRequest_Resize) GetCols() uint32 {
if x != nil {
return x.xxx_hidden_Cols
}
return 0
}
func (x *StreamRequest_Resize) GetX() uint32 {
if x != nil {
return x.xxx_hidden_X
}
return 0
}
func (x *StreamRequest_Resize) GetY() uint32 {
if x != nil {
return x.xxx_hidden_Y
}
return 0
}
func (x *StreamRequest_Resize) SetIndex(v uint32) {
x.xxx_hidden_Index = v
}
func (x *StreamRequest_Resize) SetFd(v uint32) {
x.xxx_hidden_Fd = v
}
func (x *StreamRequest_Resize) SetRows(v uint32) {
x.xxx_hidden_Rows = v
}
func (x *StreamRequest_Resize) SetCols(v uint32) {
x.xxx_hidden_Cols = v
}
func (x *StreamRequest_Resize) SetX(v uint32) {
x.xxx_hidden_X = v
}
func (x *StreamRequest_Resize) SetY(v uint32) {
x.xxx_hidden_Y = v
}
type StreamRequest_Resize_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
Index uint32
Fd uint32
Rows uint32
Cols uint32
X uint32
Y uint32
}
func (b0 StreamRequest_Resize_builder) Build() *StreamRequest_Resize {
m0 := &StreamRequest_Resize{}
b, x := &b0, m0
_, _ = b, x
x.xxx_hidden_Index = b.Index
x.xxx_hidden_Fd = b.Fd
x.xxx_hidden_Rows = b.Rows
x.xxx_hidden_Cols = b.Cols
x.xxx_hidden_X = b.X
x.xxx_hidden_Y = b.Y
return m0
}
var File_stream_request_proto protoreflect.FileDescriptor
const file_stream_request_proto_rawDesc = "" +
"\n" +
"\x14stream_request.proto\x12\x02pb\x1a\x1bgoogle/protobuf/empty.proto\x1a\rrequest.proto\x1a!google/protobuf/go_features.proto\"\xb7\x03\n" +
"\rStreamRequest\x12/\n" +
"\vexecRequest\x18\x01 \x01(\v2\v.pb.RequestH\x00R\vexecRequest\x127\n" +
"\texecInput\x18\x02 \x01(\v2\x17.pb.StreamRequest.InputH\x00R\texecInput\x12:\n" +
"\n" +
"execResize\x18\x03 \x01(\v2\x18.pb.StreamRequest.ResizeH\x00R\n" +
"execResize\x128\n" +
"\n" +
"execCancel\x18\x04 \x01(\v2\x16.google.protobuf.EmptyH\x00R\n" +
"execCancel\x1aG\n" +
"\x05Input\x12\x14\n" +
"\x05index\x18\x01 \x01(\rR\x05index\x12\x0e\n" +
"\x02fd\x18\x03 \x01(\rR\x02fd\x12\x18\n" +
"\acontent\x18\x02 \x01(\fR\acontent\x1ar\n" +
"\x06Resize\x12\x14\n" +
"\x05index\x18\x01 \x01(\rR\x05index\x12\x0e\n" +
"\x02fd\x18\x06 \x01(\rR\x02fd\x12\x12\n" +
"\x04rows\x18\x02 \x01(\rR\x04rows\x12\x12\n" +
"\x04cols\x18\x03 \x01(\rR\x04cols\x12\f\n" +
"\x01x\x18\x04 \x01(\rR\x01x\x12\f\n" +
"\x01y\x18\x05 \x01(\rR\x01yB\t\n" +
"\arequestB)Z\x1dgithub.com/criyle/go-judge/pb\x92\x03\a\xd2>\x02\x10\x02\b\x02b\beditionsp\xe8\a"
var file_stream_request_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_stream_request_proto_goTypes = []any{
(*StreamRequest)(nil), // 0: pb.StreamRequest
(*StreamRequest_Input)(nil), // 1: pb.StreamRequest.Input
(*StreamRequest_Resize)(nil), // 2: pb.StreamRequest.Resize
(*Request)(nil), // 3: pb.Request
(*emptypb.Empty)(nil), // 4: google.protobuf.Empty
}
var file_stream_request_proto_depIdxs = []int32{
3, // 0: pb.StreamRequest.execRequest:type_name -> pb.Request
1, // 1: pb.StreamRequest.execInput:type_name -> pb.StreamRequest.Input
2, // 2: pb.StreamRequest.execResize:type_name -> pb.StreamRequest.Resize
4, // 3: pb.StreamRequest.execCancel:type_name -> google.protobuf.Empty
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_stream_request_proto_init() }
func file_stream_request_proto_init() {
if File_stream_request_proto != nil {
return
}
file_request_proto_init()
file_stream_request_proto_msgTypes[0].OneofWrappers = []any{
(*streamRequest_ExecRequest)(nil),
(*streamRequest_ExecInput)(nil),
(*streamRequest_ExecResize)(nil),
(*streamRequest_ExecCancel)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_stream_request_proto_rawDesc), len(file_stream_request_proto_rawDesc)),
NumEnums: 0,
NumMessages: 3,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_stream_request_proto_goTypes,
DependencyIndexes: file_stream_request_proto_depIdxs,
MessageInfos: file_stream_request_proto_msgTypes,
}.Build()
File_stream_request_proto = out.File
file_stream_request_proto_goTypes = nil
file_stream_request_proto_depIdxs = nil
}

View File

@ -4,13 +4,15 @@
// protoc v6.31.1
// source: stream_response.proto
//go:build !protoopaque
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
_ "google.golang.org/protobuf/types/gofeaturespb"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
@ -22,7 +24,7 @@ const (
)
type StreamResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"hybrid.v1"`
// Types that are valid to be assigned to Response:
//
// *StreamResponse_ExecResponse
@ -57,11 +59,6 @@ func (x *StreamResponse) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use StreamResponse.ProtoReflect.Descriptor instead.
func (*StreamResponse) Descriptor() ([]byte, []int) {
return file_stream_response_proto_rawDescGZIP(), []int{0}
}
func (x *StreamResponse) GetResponse() isStreamResponse_Response {
if x != nil {
return x.Response
@ -87,6 +84,111 @@ func (x *StreamResponse) GetExecOutput() *StreamResponse_Output {
return nil
}
func (x *StreamResponse) SetExecResponse(v *Response) {
if v == nil {
x.Response = nil
return
}
x.Response = &StreamResponse_ExecResponse{v}
}
func (x *StreamResponse) SetExecOutput(v *StreamResponse_Output) {
if v == nil {
x.Response = nil
return
}
x.Response = &StreamResponse_ExecOutput{v}
}
func (x *StreamResponse) HasResponse() bool {
if x == nil {
return false
}
return x.Response != nil
}
func (x *StreamResponse) HasExecResponse() bool {
if x == nil {
return false
}
_, ok := x.Response.(*StreamResponse_ExecResponse)
return ok
}
func (x *StreamResponse) HasExecOutput() bool {
if x == nil {
return false
}
_, ok := x.Response.(*StreamResponse_ExecOutput)
return ok
}
func (x *StreamResponse) ClearResponse() {
x.Response = nil
}
func (x *StreamResponse) ClearExecResponse() {
if _, ok := x.Response.(*StreamResponse_ExecResponse); ok {
x.Response = nil
}
}
func (x *StreamResponse) ClearExecOutput() {
if _, ok := x.Response.(*StreamResponse_ExecOutput); ok {
x.Response = nil
}
}
const StreamResponse_Response_not_set_case case_StreamResponse_Response = 0
const StreamResponse_ExecResponse_case case_StreamResponse_Response = 1
const StreamResponse_ExecOutput_case case_StreamResponse_Response = 2
func (x *StreamResponse) WhichResponse() case_StreamResponse_Response {
if x == nil {
return StreamResponse_Response_not_set_case
}
switch x.Response.(type) {
case *StreamResponse_ExecResponse:
return StreamResponse_ExecResponse_case
case *StreamResponse_ExecOutput:
return StreamResponse_ExecOutput_case
default:
return StreamResponse_Response_not_set_case
}
}
type StreamResponse_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Fields of oneof Response:
ExecResponse *Response
ExecOutput *StreamResponse_Output
// -- end of Response
}
func (b0 StreamResponse_builder) Build() *StreamResponse {
m0 := &StreamResponse{}
b, x := &b0, m0
_, _ = b, x
if b.ExecResponse != nil {
x.Response = &StreamResponse_ExecResponse{b.ExecResponse}
}
if b.ExecOutput != nil {
x.Response = &StreamResponse_ExecOutput{b.ExecOutput}
}
return m0
}
type case_StreamResponse_Response protoreflect.FieldNumber
func (x case_StreamResponse_Response) String() string {
md := file_stream_response_proto_msgTypes[0].Descriptor()
if x == 0 {
return "not set"
}
return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x))
}
type isStreamResponse_Response interface {
isStreamResponse_Response()
}
@ -104,7 +206,7 @@ func (*StreamResponse_ExecResponse) isStreamResponse_Response() {}
func (*StreamResponse_ExecOutput) isStreamResponse_Response() {}
type StreamResponse_Output struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"hybrid.v1"`
Index uint32 `protobuf:"varint,1,opt,name=index" json:"index,omitempty"`
Fd uint32 `protobuf:"varint,3,opt,name=fd" json:"fd,omitempty"`
Content []byte `protobuf:"bytes,2,opt,name=content" json:"content,omitempty"`
@ -137,11 +239,6 @@ func (x *StreamResponse_Output) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use StreamResponse_Output.ProtoReflect.Descriptor instead.
func (*StreamResponse_Output) Descriptor() ([]byte, []int) {
return file_stream_response_proto_rawDescGZIP(), []int{0, 0}
}
func (x *StreamResponse_Output) GetIndex() uint32 {
if x != nil {
return x.Index
@ -163,11 +260,44 @@ func (x *StreamResponse_Output) GetContent() []byte {
return nil
}
func (x *StreamResponse_Output) SetIndex(v uint32) {
x.Index = v
}
func (x *StreamResponse_Output) SetFd(v uint32) {
x.Fd = v
}
func (x *StreamResponse_Output) SetContent(v []byte) {
if v == nil {
v = []byte{}
}
x.Content = v
}
type StreamResponse_Output_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
Index uint32
Fd uint32
Content []byte
}
func (b0 StreamResponse_Output_builder) Build() *StreamResponse_Output {
m0 := &StreamResponse_Output{}
b, x := &b0, m0
_, _ = b, x
x.Index = b.Index
x.Fd = b.Fd
x.Content = b.Content
return m0
}
var File_stream_response_proto protoreflect.FileDescriptor
const file_stream_response_proto_rawDesc = "" +
"\n" +
"\x15stream_response.proto\x12\x02pb\x1a\x0eresponse.proto\"\xd7\x01\n" +
"\x15stream_response.proto\x12\x02pb\x1a\x0eresponse.proto\x1a!google/protobuf/go_features.proto\"\xd7\x01\n" +
"\x0eStreamResponse\x122\n" +
"\fexecResponse\x18\x01 \x01(\v2\f.pb.ResponseH\x00R\fexecResponse\x12;\n" +
"\n" +
@ -178,19 +308,7 @@ const file_stream_response_proto_rawDesc = "" +
"\x02fd\x18\x03 \x01(\rR\x02fd\x12\x18\n" +
"\acontent\x18\x02 \x01(\fR\acontentB\n" +
"\n" +
"\bresponseB$Z\x1dgithub.com/criyle/go-judge/pb\x92\x03\x02\b\x02b\beditionsp\xe8\a"
var (
file_stream_response_proto_rawDescOnce sync.Once
file_stream_response_proto_rawDescData []byte
)
func file_stream_response_proto_rawDescGZIP() []byte {
file_stream_response_proto_rawDescOnce.Do(func() {
file_stream_response_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_stream_response_proto_rawDesc), len(file_stream_response_proto_rawDesc)))
})
return file_stream_response_proto_rawDescData
}
"\bresponseB)Z\x1dgithub.com/criyle/go-judge/pb\x92\x03\a\xd2>\x02\x10\x02\b\x02b\beditionsp\xe8\a"
var file_stream_response_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_stream_response_proto_goTypes = []any{

View File

@ -4,8 +4,10 @@ package pb;
option features.field_presence = IMPLICIT;
option go_package = "github.com/criyle/go-judge/pb";
option features.(pb.go).api_level = API_HYBRID;
import "response.proto";
import "google/protobuf/go_features.proto";
message StreamResponse {
message Output {

View File

@ -0,0 +1,345 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.6
// protoc v6.31.1
// source: stream_response.proto
//go:build protoopaque
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
_ "google.golang.org/protobuf/types/gofeaturespb"
reflect "reflect"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type StreamResponse struct {
state protoimpl.MessageState `protogen:"opaque.v1"`
xxx_hidden_Response isStreamResponse_Response `protobuf_oneof:"response"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *StreamResponse) Reset() {
*x = StreamResponse{}
mi := &file_stream_response_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *StreamResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StreamResponse) ProtoMessage() {}
func (x *StreamResponse) ProtoReflect() protoreflect.Message {
mi := &file_stream_response_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *StreamResponse) GetExecResponse() *Response {
if x != nil {
if x, ok := x.xxx_hidden_Response.(*streamResponse_ExecResponse); ok {
return x.ExecResponse
}
}
return nil
}
func (x *StreamResponse) GetExecOutput() *StreamResponse_Output {
if x != nil {
if x, ok := x.xxx_hidden_Response.(*streamResponse_ExecOutput); ok {
return x.ExecOutput
}
}
return nil
}
func (x *StreamResponse) SetExecResponse(v *Response) {
if v == nil {
x.xxx_hidden_Response = nil
return
}
x.xxx_hidden_Response = &streamResponse_ExecResponse{v}
}
func (x *StreamResponse) SetExecOutput(v *StreamResponse_Output) {
if v == nil {
x.xxx_hidden_Response = nil
return
}
x.xxx_hidden_Response = &streamResponse_ExecOutput{v}
}
func (x *StreamResponse) HasResponse() bool {
if x == nil {
return false
}
return x.xxx_hidden_Response != nil
}
func (x *StreamResponse) HasExecResponse() bool {
if x == nil {
return false
}
_, ok := x.xxx_hidden_Response.(*streamResponse_ExecResponse)
return ok
}
func (x *StreamResponse) HasExecOutput() bool {
if x == nil {
return false
}
_, ok := x.xxx_hidden_Response.(*streamResponse_ExecOutput)
return ok
}
func (x *StreamResponse) ClearResponse() {
x.xxx_hidden_Response = nil
}
func (x *StreamResponse) ClearExecResponse() {
if _, ok := x.xxx_hidden_Response.(*streamResponse_ExecResponse); ok {
x.xxx_hidden_Response = nil
}
}
func (x *StreamResponse) ClearExecOutput() {
if _, ok := x.xxx_hidden_Response.(*streamResponse_ExecOutput); ok {
x.xxx_hidden_Response = nil
}
}
const StreamResponse_Response_not_set_case case_StreamResponse_Response = 0
const StreamResponse_ExecResponse_case case_StreamResponse_Response = 1
const StreamResponse_ExecOutput_case case_StreamResponse_Response = 2
func (x *StreamResponse) WhichResponse() case_StreamResponse_Response {
if x == nil {
return StreamResponse_Response_not_set_case
}
switch x.xxx_hidden_Response.(type) {
case *streamResponse_ExecResponse:
return StreamResponse_ExecResponse_case
case *streamResponse_ExecOutput:
return StreamResponse_ExecOutput_case
default:
return StreamResponse_Response_not_set_case
}
}
type StreamResponse_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Fields of oneof xxx_hidden_Response:
ExecResponse *Response
ExecOutput *StreamResponse_Output
// -- end of xxx_hidden_Response
}
func (b0 StreamResponse_builder) Build() *StreamResponse {
m0 := &StreamResponse{}
b, x := &b0, m0
_, _ = b, x
if b.ExecResponse != nil {
x.xxx_hidden_Response = &streamResponse_ExecResponse{b.ExecResponse}
}
if b.ExecOutput != nil {
x.xxx_hidden_Response = &streamResponse_ExecOutput{b.ExecOutput}
}
return m0
}
type case_StreamResponse_Response protoreflect.FieldNumber
func (x case_StreamResponse_Response) String() string {
md := file_stream_response_proto_msgTypes[0].Descriptor()
if x == 0 {
return "not set"
}
return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x))
}
type isStreamResponse_Response interface {
isStreamResponse_Response()
}
type streamResponse_ExecResponse struct {
ExecResponse *Response `protobuf:"bytes,1,opt,name=execResponse,oneof"`
}
type streamResponse_ExecOutput struct {
ExecOutput *StreamResponse_Output `protobuf:"bytes,2,opt,name=execOutput,oneof"`
}
func (*streamResponse_ExecResponse) isStreamResponse_Response() {}
func (*streamResponse_ExecOutput) isStreamResponse_Response() {}
type StreamResponse_Output struct {
state protoimpl.MessageState `protogen:"opaque.v1"`
xxx_hidden_Index uint32 `protobuf:"varint,1,opt,name=index"`
xxx_hidden_Fd uint32 `protobuf:"varint,3,opt,name=fd"`
xxx_hidden_Content []byte `protobuf:"bytes,2,opt,name=content"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *StreamResponse_Output) Reset() {
*x = StreamResponse_Output{}
mi := &file_stream_response_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *StreamResponse_Output) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StreamResponse_Output) ProtoMessage() {}
func (x *StreamResponse_Output) ProtoReflect() protoreflect.Message {
mi := &file_stream_response_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *StreamResponse_Output) GetIndex() uint32 {
if x != nil {
return x.xxx_hidden_Index
}
return 0
}
func (x *StreamResponse_Output) GetFd() uint32 {
if x != nil {
return x.xxx_hidden_Fd
}
return 0
}
func (x *StreamResponse_Output) GetContent() []byte {
if x != nil {
return x.xxx_hidden_Content
}
return nil
}
func (x *StreamResponse_Output) SetIndex(v uint32) {
x.xxx_hidden_Index = v
}
func (x *StreamResponse_Output) SetFd(v uint32) {
x.xxx_hidden_Fd = v
}
func (x *StreamResponse_Output) SetContent(v []byte) {
if v == nil {
v = []byte{}
}
x.xxx_hidden_Content = v
}
type StreamResponse_Output_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
Index uint32
Fd uint32
Content []byte
}
func (b0 StreamResponse_Output_builder) Build() *StreamResponse_Output {
m0 := &StreamResponse_Output{}
b, x := &b0, m0
_, _ = b, x
x.xxx_hidden_Index = b.Index
x.xxx_hidden_Fd = b.Fd
x.xxx_hidden_Content = b.Content
return m0
}
var File_stream_response_proto protoreflect.FileDescriptor
const file_stream_response_proto_rawDesc = "" +
"\n" +
"\x15stream_response.proto\x12\x02pb\x1a\x0eresponse.proto\x1a!google/protobuf/go_features.proto\"\xd7\x01\n" +
"\x0eStreamResponse\x122\n" +
"\fexecResponse\x18\x01 \x01(\v2\f.pb.ResponseH\x00R\fexecResponse\x12;\n" +
"\n" +
"execOutput\x18\x02 \x01(\v2\x19.pb.StreamResponse.OutputH\x00R\n" +
"execOutput\x1aH\n" +
"\x06Output\x12\x14\n" +
"\x05index\x18\x01 \x01(\rR\x05index\x12\x0e\n" +
"\x02fd\x18\x03 \x01(\rR\x02fd\x12\x18\n" +
"\acontent\x18\x02 \x01(\fR\acontentB\n" +
"\n" +
"\bresponseB)Z\x1dgithub.com/criyle/go-judge/pb\x92\x03\a\xd2>\x02\x10\x02\b\x02b\beditionsp\xe8\a"
var file_stream_response_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_stream_response_proto_goTypes = []any{
(*StreamResponse)(nil), // 0: pb.StreamResponse
(*StreamResponse_Output)(nil), // 1: pb.StreamResponse.Output
(*Response)(nil), // 2: pb.Response
}
var file_stream_response_proto_depIdxs = []int32{
2, // 0: pb.StreamResponse.execResponse:type_name -> pb.Response
1, // 1: pb.StreamResponse.execOutput:type_name -> pb.StreamResponse.Output
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_stream_response_proto_init() }
func file_stream_response_proto_init() {
if File_stream_response_proto != nil {
return
}
file_response_proto_init()
file_stream_response_proto_msgTypes[0].OneofWrappers = []any{
(*streamResponse_ExecResponse)(nil),
(*streamResponse_ExecOutput)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_stream_response_proto_rawDesc), len(file_stream_response_proto_rawDesc)),
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_stream_response_proto_goTypes,
DependencyIndexes: file_stream_response_proto_depIdxs,
MessageInfos: file_stream_response_proto_msgTypes,
}.Build()
File_stream_response_proto = out.File
file_stream_response_proto_goTypes = nil
file_stream_response_proto_depIdxs = nil
}