mirror of
https://github.com/criyle/go-judge.git
synced 2025-11-04 14:50:02 +08:00
110 lines
2.2 KiB
Protocol Buffer
110 lines
2.2 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package pb;
|
|
|
|
option go_package = "github.com/criyle/go-judge/pb";
|
|
|
|
service Executor {
|
|
rpc Exec(Request) returns (Response);
|
|
rpc FileList(Empty) returns (FileListType);
|
|
rpc FileGet(FileID) returns (FileContent);
|
|
rpc FileAdd(FileContent) returns (FileID);
|
|
rpc FileDelete(FileID) returns (Empty);
|
|
};
|
|
|
|
message Empty {}
|
|
|
|
message FileID { string fileID = 1; }
|
|
|
|
message FileContent {
|
|
string name = 1;
|
|
bytes content = 2;
|
|
}
|
|
|
|
message FileListType { repeated string fileIDs = 1; }
|
|
|
|
message Request {
|
|
message LocalFile { string src = 1; }
|
|
|
|
message MemoryFile { bytes content = 1; }
|
|
|
|
message CachedFile { string fileID = 1; }
|
|
|
|
message PipeCollector {
|
|
string name = 1;
|
|
int64 max = 2;
|
|
}
|
|
|
|
message File {
|
|
oneof file {
|
|
LocalFile local = 1;
|
|
MemoryFile memory = 2;
|
|
CachedFile cached = 3;
|
|
PipeCollector pipe = 4;
|
|
}
|
|
}
|
|
|
|
message CmdType {
|
|
repeated string args = 1;
|
|
repeated string env = 2;
|
|
repeated File files = 3;
|
|
|
|
uint64 CPULimit = 4;
|
|
uint64 realCPULimit = 5;
|
|
uint64 memoryLimit = 6;
|
|
uint64 procLimit = 7;
|
|
|
|
map<string, File> copyIn = 8;
|
|
|
|
repeated string copyOut = 9;
|
|
repeated string copyOutCached = 10;
|
|
string copyOutDir = 11;
|
|
}
|
|
|
|
message PipeMap {
|
|
message PipeIndex {
|
|
int32 index = 1;
|
|
int32 fd = 2;
|
|
}
|
|
|
|
PipeIndex in = 1;
|
|
PipeIndex out = 2;
|
|
}
|
|
|
|
string requestID = 1;
|
|
repeated CmdType cmd = 2;
|
|
repeated PipeMap pipeMapping = 3;
|
|
}
|
|
|
|
message Response {
|
|
message Result {
|
|
enum StatusType {
|
|
Invalid = 0;
|
|
Accepted = 1;
|
|
WrongAnswer = 2; // Not used
|
|
PartiallyCorrect = 3; // Not used
|
|
MemoryLimitExceeded = 4;
|
|
TimeLimitExceeded = 5;
|
|
OutputLimitExceeded = 6;
|
|
FileError = 7;
|
|
NonZeroExitStatus = 8;
|
|
Signalled = 9;
|
|
DangerousSyscall = 10;
|
|
JudgementFailed = 11;
|
|
InvalidInteraction = 12; // Not used
|
|
InternalError = 13;
|
|
}
|
|
|
|
StatusType status = 1;
|
|
int32 exitStatus = 2;
|
|
string error = 3;
|
|
uint64 time = 4;
|
|
uint64 memory = 5;
|
|
map<string, bytes> files = 6;
|
|
map<string, string> fileIDs = 7;
|
|
}
|
|
string requestID = 1;
|
|
repeated Result results = 2;
|
|
string error = 3;
|
|
}
|