Documentation
¶
Overview ¶
Package pb_jg is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterCodeHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterCodeHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CodeClient) error
- func RegisterCodeHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterCodeHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CodeServer) error
- func RegisterCodeServer(s grpc.ServiceRegistrar, srv CodeServer)
- type CodeClient
- type CodeResult
- func (*CodeResult) Descriptor() ([]byte, []int)deprecated
- func (x *CodeResult) GetCaseId() uint32
- func (x *CodeResult) GetCpuTimeUsage() float64
- func (x *CodeResult) GetMemoryUsage() float64
- func (x *CodeResult) GetRealTimeUsage() float64
- func (x *CodeResult) GetState() sandbox.State
- func (*CodeResult) ProtoMessage()
- func (x *CodeResult) ProtoReflect() protoreflect.Message
- func (x *CodeResult) Reset()
- func (x *CodeResult) String() string
- type CodeServer
- type JudgeCodeRequest
- func (*JudgeCodeRequest) Descriptor() ([]byte, []int)deprecated
- func (x *JudgeCodeRequest) GetCase() []*sandbox.Case
- func (x *JudgeCodeRequest) GetCode() string
- func (x *JudgeCodeRequest) GetLang() sandbox.Language
- func (x *JudgeCodeRequest) GetMemory() uint32
- func (x *JudgeCodeRequest) GetOutMsgLimit() uint32
- func (x *JudgeCodeRequest) GetTime() uint32
- func (*JudgeCodeRequest) ProtoMessage()
- func (x *JudgeCodeRequest) ProtoReflect() protoreflect.Message
- func (x *JudgeCodeRequest) Reset()
- func (x *JudgeCodeRequest) String() string
- type JudgeCodeResponse
- func (*JudgeCodeResponse) Descriptor() ([]byte, []int)deprecated
- func (x *JudgeCodeResponse) GetCodeResults() []*CodeResult
- func (x *JudgeCodeResponse) GetMaxMemoryUsage() float64
- func (x *JudgeCodeResponse) GetMaxTimeUsage() float64
- func (x *JudgeCodeResponse) GetOutPut() string
- func (x *JudgeCodeResponse) GetState() sandbox.State
- func (*JudgeCodeResponse) ProtoMessage()
- func (x *JudgeCodeResponse) ProtoReflect() protoreflect.Message
- func (x *JudgeCodeResponse) Reset()
- func (x *JudgeCodeResponse) String() string
- type RunCodeRequest
- func (*RunCodeRequest) Descriptor() ([]byte, []int)deprecated
- func (x *RunCodeRequest) GetCode() string
- func (x *RunCodeRequest) GetInput() string
- func (x *RunCodeRequest) GetLang() sandbox.Language
- func (x *RunCodeRequest) GetMemory() uint32
- func (x *RunCodeRequest) GetOutMsgLimit() uint32
- func (x *RunCodeRequest) GetTime() uint32
- func (*RunCodeRequest) ProtoMessage()
- func (x *RunCodeRequest) ProtoReflect() protoreflect.Message
- func (x *RunCodeRequest) Reset()
- func (x *RunCodeRequest) String() string
- type RunCodeResponse
- func (*RunCodeResponse) Descriptor() ([]byte, []int)deprecated
- func (x *RunCodeResponse) GetCpuTimeUsage() float64
- func (x *RunCodeResponse) GetMemoryUsage() float64
- func (x *RunCodeResponse) GetOutPut() string
- func (x *RunCodeResponse) GetRealTimeUsage() float64
- func (x *RunCodeResponse) GetState() sandbox.State
- func (*RunCodeResponse) ProtoMessage()
- func (x *RunCodeResponse) ProtoReflect() protoreflect.Message
- func (x *RunCodeResponse) Reset()
- func (x *RunCodeResponse) String() string
- type UnimplementedCodeServer
- type UnsafeCodeServer
Constants ¶
This section is empty.
Variables ¶
var Code_ServiceDesc = grpc.ServiceDesc{ ServiceName: "v1.judger.Code", HandlerType: (*CodeServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "RunCode", Handler: _Code_RunCode_Handler, }, { MethodName: "JudgeCode", Handler: _Code_JudgeCode_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "judger/judger_service.proto", }
Code_ServiceDesc is the grpc.ServiceDesc for Code service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_judger_judger_message_proto protoreflect.FileDescriptor
var File_judger_judger_service_proto protoreflect.FileDescriptor
Functions ¶
func RegisterCodeHandler ¶
RegisterCodeHandler registers the http handlers for service Code to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterCodeHandlerClient ¶
RegisterCodeHandlerClient registers the http handlers for service Code to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "CodeClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "CodeClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "CodeClient" to call the correct interceptors.
func RegisterCodeHandlerFromEndpoint ¶
func RegisterCodeHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterCodeHandlerFromEndpoint is same as RegisterCodeHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterCodeHandlerServer ¶
RegisterCodeHandlerServer registers the http handlers for service Code to "mux". UnaryRPC :call CodeServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterCodeHandlerFromEndpoint instead.
func RegisterCodeServer ¶
func RegisterCodeServer(s grpc.ServiceRegistrar, srv CodeServer)
Types ¶
type CodeClient ¶
type CodeClient interface { // 运行代码 RunCode(ctx context.Context, in *RunCodeRequest, opts ...grpc.CallOption) (*RunCodeResponse, error) // 判题 JudgeCode(ctx context.Context, in *JudgeCodeRequest, opts ...grpc.CallOption) (*JudgeCodeResponse, error) }
CodeClient is the client API for Code service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewCodeClient ¶
func NewCodeClient(cc grpc.ClientConnInterface) CodeClient
type CodeResult ¶
type CodeResult struct { CaseId uint32 `protobuf:"varint,1,opt,name=case_id,json=caseId,proto3" json:"case_id,omitempty"` // 程序运行Cpu耗时(ms) CpuTimeUsage float64 `protobuf:"fixed64,2,opt,name=cpu_time_usage,json=cpuTimeUsage,proto3" json:"cpu_time_usage,omitempty"` // 程序运行总耗时(ms) RealTimeUsage float64 `protobuf:"fixed64,3,opt,name=real_time_usage,json=realTimeUsage,proto3" json:"real_time_usage,omitempty"` // 程序使用内存(kb) MemoryUsage float64 `protobuf:"fixed64,4,opt,name=memory_usage,json=memoryUsage,proto3" json:"memory_usage,omitempty"` State sandbox.State `protobuf:"varint,5,opt,name=state,proto3,enum=v1.sandbox.State" json:"state,omitempty"` // contains filtered or unexported fields }
func (*CodeResult) Descriptor
deprecated
func (*CodeResult) Descriptor() ([]byte, []int)
Deprecated: Use CodeResult.ProtoReflect.Descriptor instead.
func (*CodeResult) GetCaseId ¶
func (x *CodeResult) GetCaseId() uint32
func (*CodeResult) GetCpuTimeUsage ¶
func (x *CodeResult) GetCpuTimeUsage() float64
func (*CodeResult) GetMemoryUsage ¶
func (x *CodeResult) GetMemoryUsage() float64
func (*CodeResult) GetRealTimeUsage ¶
func (x *CodeResult) GetRealTimeUsage() float64
func (*CodeResult) GetState ¶
func (x *CodeResult) GetState() sandbox.State
func (*CodeResult) ProtoMessage ¶
func (*CodeResult) ProtoMessage()
func (*CodeResult) ProtoReflect ¶
func (x *CodeResult) ProtoReflect() protoreflect.Message
func (*CodeResult) Reset ¶
func (x *CodeResult) Reset()
func (*CodeResult) String ¶
func (x *CodeResult) String() string
type CodeServer ¶
type CodeServer interface { // 运行代码 RunCode(context.Context, *RunCodeRequest) (*RunCodeResponse, error) // 判题 JudgeCode(context.Context, *JudgeCodeRequest) (*JudgeCodeResponse, error) // contains filtered or unexported methods }
CodeServer is the server API for Code service. All implementations must embed UnimplementedCodeServer for forward compatibility
type JudgeCodeRequest ¶
type JudgeCodeRequest struct { // 编程语言 Lang sandbox.Language `protobuf:"varint,1,opt,name=lang,proto3,enum=v1.sandbox.Language" json:"lang,omitempty"` // 程序源代码 Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"` // 限定运行时间(单位: ms) Time uint32 `protobuf:"varint,3,opt,name=time,proto3" json:"time,omitempty"` // 限定程序使用内存(单位: mb) Memory uint32 `protobuf:"varint,4,opt,name=memory,proto3" json:"memory,omitempty"` // 限定输出内容大小(0 表示使用默认值, 单位: kb) OutMsgLimit uint32 `protobuf:"varint,5,opt,name=out_msg_limit,json=outMsgLimit,proto3" json:"out_msg_limit,omitempty"` Case []*sandbox.Case `protobuf:"bytes,6,rep,name=case,proto3" json:"case,omitempty"` // contains filtered or unexported fields }
func (*JudgeCodeRequest) Descriptor
deprecated
func (*JudgeCodeRequest) Descriptor() ([]byte, []int)
Deprecated: Use JudgeCodeRequest.ProtoReflect.Descriptor instead.
func (*JudgeCodeRequest) GetCase ¶
func (x *JudgeCodeRequest) GetCase() []*sandbox.Case
func (*JudgeCodeRequest) GetCode ¶
func (x *JudgeCodeRequest) GetCode() string
func (*JudgeCodeRequest) GetLang ¶
func (x *JudgeCodeRequest) GetLang() sandbox.Language
func (*JudgeCodeRequest) GetMemory ¶
func (x *JudgeCodeRequest) GetMemory() uint32
func (*JudgeCodeRequest) GetOutMsgLimit ¶
func (x *JudgeCodeRequest) GetOutMsgLimit() uint32
func (*JudgeCodeRequest) GetTime ¶
func (x *JudgeCodeRequest) GetTime() uint32
func (*JudgeCodeRequest) ProtoMessage ¶
func (*JudgeCodeRequest) ProtoMessage()
func (*JudgeCodeRequest) ProtoReflect ¶
func (x *JudgeCodeRequest) ProtoReflect() protoreflect.Message
func (*JudgeCodeRequest) Reset ¶
func (x *JudgeCodeRequest) Reset()
func (*JudgeCodeRequest) String ¶
func (x *JudgeCodeRequest) String() string
type JudgeCodeResponse ¶
type JudgeCodeResponse struct { // 程序状态 State sandbox.State `protobuf:"varint,1,opt,name=state,proto3,enum=v1.sandbox.State" json:"state,omitempty"` // 程序使用最大时间(ms) MaxTimeUsage float64 `protobuf:"fixed64,2,opt,name=max_time_usage,json=maxTimeUsage,proto3" json:"max_time_usage,omitempty"` // 程序使用最大内存(byte) MaxMemoryUsage float64 `protobuf:"fixed64,3,opt,name=max_memory_usage,json=maxMemoryUsage,proto3" json:"max_memory_usage,omitempty"` OutPut string `protobuf:"bytes,4,opt,name=out_put,json=outPut,proto3" json:"out_put,omitempty"` CodeResults []*CodeResult `protobuf:"bytes,5,rep,name=code_results,json=codeResults,proto3" json:"code_results,omitempty"` // contains filtered or unexported fields }
func (*JudgeCodeResponse) Descriptor
deprecated
func (*JudgeCodeResponse) Descriptor() ([]byte, []int)
Deprecated: Use JudgeCodeResponse.ProtoReflect.Descriptor instead.
func (*JudgeCodeResponse) GetCodeResults ¶
func (x *JudgeCodeResponse) GetCodeResults() []*CodeResult
func (*JudgeCodeResponse) GetMaxMemoryUsage ¶
func (x *JudgeCodeResponse) GetMaxMemoryUsage() float64
func (*JudgeCodeResponse) GetMaxTimeUsage ¶
func (x *JudgeCodeResponse) GetMaxTimeUsage() float64
func (*JudgeCodeResponse) GetOutPut ¶
func (x *JudgeCodeResponse) GetOutPut() string
func (*JudgeCodeResponse) GetState ¶
func (x *JudgeCodeResponse) GetState() sandbox.State
func (*JudgeCodeResponse) ProtoMessage ¶
func (*JudgeCodeResponse) ProtoMessage()
func (*JudgeCodeResponse) ProtoReflect ¶
func (x *JudgeCodeResponse) ProtoReflect() protoreflect.Message
func (*JudgeCodeResponse) Reset ¶
func (x *JudgeCodeResponse) Reset()
func (*JudgeCodeResponse) String ¶
func (x *JudgeCodeResponse) String() string
type RunCodeRequest ¶
type RunCodeRequest struct { // 编程语言 Lang sandbox.Language `protobuf:"varint,1,opt,name=lang,proto3,enum=v1.sandbox.Language" json:"lang,omitempty"` // 程序源代码 Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"` // 程序输入内容 Input string `protobuf:"bytes,3,opt,name=input,proto3" json:"input,omitempty"` // 限定运行时间(单位: ms [0, 2000]) Time uint32 `protobuf:"varint,4,opt,name=time,proto3" json:"time,omitempty"` // 限定程序使用内存(单位: mb [1, 256]) Memory uint32 `protobuf:"varint,5,opt,name=memory,proto3" json:"memory,omitempty"` // 限定输出内容大小(0 表示使用默认值,单位: kb) OutMsgLimit uint32 `protobuf:"varint,6,opt,name=out_msg_limit,json=outMsgLimit,proto3" json:"out_msg_limit,omitempty"` // contains filtered or unexported fields }
func (*RunCodeRequest) Descriptor
deprecated
func (*RunCodeRequest) Descriptor() ([]byte, []int)
Deprecated: Use RunCodeRequest.ProtoReflect.Descriptor instead.
func (*RunCodeRequest) GetCode ¶
func (x *RunCodeRequest) GetCode() string
func (*RunCodeRequest) GetInput ¶
func (x *RunCodeRequest) GetInput() string
func (*RunCodeRequest) GetLang ¶
func (x *RunCodeRequest) GetLang() sandbox.Language
func (*RunCodeRequest) GetMemory ¶
func (x *RunCodeRequest) GetMemory() uint32
func (*RunCodeRequest) GetOutMsgLimit ¶
func (x *RunCodeRequest) GetOutMsgLimit() uint32
func (*RunCodeRequest) GetTime ¶
func (x *RunCodeRequest) GetTime() uint32
func (*RunCodeRequest) ProtoMessage ¶
func (*RunCodeRequest) ProtoMessage()
func (*RunCodeRequest) ProtoReflect ¶
func (x *RunCodeRequest) ProtoReflect() protoreflect.Message
func (*RunCodeRequest) Reset ¶
func (x *RunCodeRequest) Reset()
func (*RunCodeRequest) String ¶
func (x *RunCodeRequest) String() string
type RunCodeResponse ¶
type RunCodeResponse struct { // 程序输出 OutPut string `protobuf:"bytes,1,opt,name=out_put,json=outPut,proto3" json:"out_put,omitempty"` // 程序运行Cpu耗时(ms) CpuTimeUsage float64 `protobuf:"fixed64,2,opt,name=cpu_time_usage,json=cpuTimeUsage,proto3" json:"cpu_time_usage,omitempty"` // 程序运行总耗时(ms) RealTimeUsage float64 `protobuf:"fixed64,3,opt,name=real_time_usage,json=realTimeUsage,proto3" json:"real_time_usage,omitempty"` // 程序使用内存(kb) MemoryUsage float64 `protobuf:"fixed64,4,opt,name=memory_usage,json=memoryUsage,proto3" json:"memory_usage,omitempty"` // 程序运行状态 State sandbox.State `protobuf:"varint,5,opt,name=state,proto3,enum=v1.sandbox.State" json:"state,omitempty"` // contains filtered or unexported fields }
func (*RunCodeResponse) Descriptor
deprecated
func (*RunCodeResponse) Descriptor() ([]byte, []int)
Deprecated: Use RunCodeResponse.ProtoReflect.Descriptor instead.
func (*RunCodeResponse) GetCpuTimeUsage ¶
func (x *RunCodeResponse) GetCpuTimeUsage() float64
func (*RunCodeResponse) GetMemoryUsage ¶
func (x *RunCodeResponse) GetMemoryUsage() float64
func (*RunCodeResponse) GetOutPut ¶
func (x *RunCodeResponse) GetOutPut() string
func (*RunCodeResponse) GetRealTimeUsage ¶
func (x *RunCodeResponse) GetRealTimeUsage() float64
func (*RunCodeResponse) GetState ¶
func (x *RunCodeResponse) GetState() sandbox.State
func (*RunCodeResponse) ProtoMessage ¶
func (*RunCodeResponse) ProtoMessage()
func (*RunCodeResponse) ProtoReflect ¶
func (x *RunCodeResponse) ProtoReflect() protoreflect.Message
func (*RunCodeResponse) Reset ¶
func (x *RunCodeResponse) Reset()
func (*RunCodeResponse) String ¶
func (x *RunCodeResponse) String() string
type UnimplementedCodeServer ¶
type UnimplementedCodeServer struct { }
UnimplementedCodeServer must be embedded to have forward compatible implementations.
func (UnimplementedCodeServer) JudgeCode ¶
func (UnimplementedCodeServer) JudgeCode(context.Context, *JudgeCodeRequest) (*JudgeCodeResponse, error)
func (UnimplementedCodeServer) RunCode ¶
func (UnimplementedCodeServer) RunCode(context.Context, *RunCodeRequest) (*RunCodeResponse, error)
type UnsafeCodeServer ¶
type UnsafeCodeServer interface {
// contains filtered or unexported methods
}
UnsafeCodeServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to CodeServer will result in compilation errors.