-
Notifications
You must be signed in to change notification settings - Fork 104
/
kennel.proto
173 lines (151 loc) · 4.92 KB
/
kennel.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
syntax = "proto3";
package wandbox.kennel;
import "extensions.proto";
message Code {
string file = 1;
string code = 2;
}
message SelectSwitchOption {
string name = 1;
string display_flags = 2 [(jsonif_name) = "display-flags"];
string display_name = 3 [(jsonif_name) = "display-name"];
}
message Switch {
option (jsonif_message_optimistic) = true;
// single か select かで出力する内容を出し分けたいが、
// optimistic や discard_if_default では default の型を切り替えるのができないので、
// シリアライザを自前で書くことにする。
option (jsonif_no_serializer) = true;
option (jsonif_no_deserializer) = true;
// single | select
string type = 1;
string name = 2;
// type == single の場合のみ
string display_name = 10 [(jsonif_name) = "display-name", (jsonif_discard_if_default) = true];
string display_flags = 11 [(jsonif_name) = "display-flags", (jsonif_discard_if_default) = true];
bool single_default = 12 [(jsonif_name) = "default"];
// type == select の場合のみ
repeated SelectSwitchOption options = 20 [(jsonif_discard_if_default) = true];
string select_default = 21 [(jsonif_name) = "default"];
}
message CompilerInfo {
option (jsonif_message_optimistic) = true;
string name = 1;
string version = 2;
string language = 3;
string display_name = 4 [(jsonif_name) = "display-name"];
repeated string templates = 5;
bool compiler_option_raw = 6 [(jsonif_name) = "compiler-option-raw"];
bool runtime_option_raw = 7 [(jsonif_name) = "runtime-option-raw"];
string display_compile_command = 8 [(jsonif_name) = "display-compile-command"];
repeated Switch switches = 9;
}
// /api/compile.json, /api/compile.ndjson のリクエストと、
// /api/permlink/<permlink-id> のレスポンスに使う
message CompileParameter {
option (jsonif_message_optimistic) = true;
// 共通
string compiler = 1;
string code = 2;
repeated Code codes = 3;
string options = 4;
string stdin = 5;
string compiler_option_raw = 6 [(jsonif_name) = "compiler-option-raw"];
string runtime_option_raw = 7 [(jsonif_name) = "runtime-option-raw"];
string github_user = 8;
// /api/compile.json と /api/permlink/<permlink-id> 用
string title = 10;
string description = 11;
// /api/compile.json 用
bool save = 20 [(jsonif_discard_if_default) = true];
// /api/permlink/<permlink-id> 用
int64 created_at = 30;
bool is_private = 31;
CompilerInfo compiler_info = 32 [(jsonif_name) = "compiler-info", (jsonif_discard_if_default) = true];
}
message Template {
string name = 1;
string stdin = 2;
string compiler_option_raw = 3 [(jsonif_name) = "compiler-option-raw"];
string runtime_option_raw = 4 [(jsonif_name) = "runtime-option-raw"];
string code = 5;
repeated Code codes = 6;
string options = 7;
}
message CattleshedInfo {
repeated CompilerInfo compilers = 1;
repeated Template templates = 2;
}
message CompileResult {
string status = 1 [(jsonif_discard_if_default) = true];
string signal = 2 [(jsonif_discard_if_default) = true];
string compiler_output = 3;
string compiler_error = 4;
string compiler_message = 5;
string program_output = 6;
string program_error = 7;
string program_message = 8;
string permlink = 9 [(jsonif_discard_if_default) = true];
string url = 10 [(jsonif_discard_if_default) = true];
}
message Sponsor {
string name = 1;
string url = 2 [(jsonif_optimistic) = true];
string due_date = 3;
}
message SponsorFile {
repeated Sponsor corporate = 1;
repeated Sponsor personal = 2;
}
message TimestampSponsor {
string name = 1;
string url = 2 [(jsonif_optimistic) = true];
int64 due_date = 3;
}
message SponsorResponse {
repeated TimestampSponsor corporate = 1;
repeated TimestampSponsor personal = 2;
}
message CompileNdjsonResult {
// type: Control, data: Start
// - 開始
// type: Control, data: Finish
// - 終了
// type: CompilerMessageS
// - コンパイル時の標準出力
// type: CompilerMessageE
// - コンパイル時の標準エラー
// type: StdOut
// - 実行時の標準出力
// type: StdErr
// - 実行時の標準エラー
// type: ExitCode
// - プログラムの終了コード
// type: Signal
// - プログラムのシグナルコード
string type = 1;
string data = 2;
}
message PostPermlinkRequest {
option (jsonif_message_optimistic) = true;
string title = 1;
string description = 2;
string compiler = 3;
string code = 4;
repeated Code codes = 5;
string options = 6;
string stdin = 7;
string compiler_option_raw = 8 [(jsonif_name) = "compiler-option-raw"];
string runtime_option_raw = 9 [(jsonif_name) = "runtime-option-raw"];
string github_user = 10;
repeated CompileNdjsonResult results = 11;
}
message PostPermlinkResponse {
string permlink = 1;
string url = 2;
}
message GetPermlinkResponse {
CompileParameter parameter = 1;
repeated CompileNdjsonResult results = 2;
CompileResult result = 3;
}