-
Notifications
You must be signed in to change notification settings - Fork 2
/
operations.thrift
378 lines (317 loc) · 8.11 KB
/
operations.thrift
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
namespace go api
struct PushRequest {
1: string producer
2: string topic
3: string key
4: binary message
5: i64 StartIndex
6: i64 EndIndex
7: i8 Size
8: i8 Ack
9: i64 Cmdindex
}
struct PushResponse {
1: bool ret
2: string err //用来回复该partition已经不在这个broker接收
}
struct PullRequest {
1: string consumer
2: string topic
3: string key
4: i64 offset
5: i8 size
6: i8 option
}
struct PullResponse {
1: binary Msgs
2: bool Ret
3: i64 Start_index
4: i64 End_index
5: i8 Size
6: string Err
}
//consmer发送自己的host和ip,使broker连接上自己
struct InfoRequest {
1: string ip_port
}
struct InfoResponse {
1: bool ret
}
//consumer准备开始接收信息
struct InfoGetRequest {
1: string cli_name
2: string topic_name
3: string part_name
4: i64 offset
5: i8 option
}
struct InfoGetResponse {
1: bool ret
}
//设置某个partition接受信息的文件和队列
struct StartGetMessageRequest {
1: string topic_name
2: string part_name
3: string file_name
}
struct StartGetMessageResponse {
1: bool ret
}
//关闭某个partition,停止接收信息,
struct CloseGetMessageRequest{
1: string topic_name
2: string part_name
3: string file_name
4: string new_name
}
struct CloseGetMessageResponse{
1: bool ret
}
//zkserver
struct PrepareAcceptRequest{
1: string topic_name
2: string part_name
3: string file_name
}
struct PrepareAcceptResponse{
1: bool ret
2: string err
}
struct PrepareStateRequest{
1: string TopicName
2: string PartName
3: i8 State
4: binary Brokers
}
struct PrepareStateResponse{
1: bool Ret
2: string Err
}
struct CloseAcceptRequest{
1: string topic_name
2: string part_name
3: string oldfilename
4: string newfilename
}
struct CloseAcceptResponse{
1: bool ret
2: i64 startindex
3: i64 endindex
}
struct PrepareSendRequest{
1: string consumer
2: string topic_name
3: string part_name
4: string file_name
5: i8 option
6: i64 offset
}
struct PrepareSendResponse{
1: bool ret
2: string err //若已经准备好“had_done”
}
struct AddRaftPartitionRequest {
1: string TopicName
2: string PartName
3: binary Brokers
}
struct AddRaftPartitionResponse{
1: bool Ret
2: string Err
}
struct CloseRaftPartitionRequest{
1: string TopicName
2: string PartName
}
struct CloseRaftPartitionResponse{
1: bool Ret
2: string Err
}
struct AddFetchPartitionRequest{
1: string TopicName
2: string PartName
3: string LeaderBroker
4: string HostPort
5: binary Brokers
6: string FileName
}
struct AddFetchPartitionResponse{
1: bool Ret
2: string Err
}
struct CloseFetchPartitionRequest{
1: string TopicName
2: string PartName
}
struct CloseFetchPartitionResponse{
1: bool Ret
2: string Err
}
service Server_Operations {
PushResponse push( 1: PushRequest req) //producer used
PullResponse pull( 1: PullRequest req) //
InfoResponse ConInfo( 1: InfoRequest req) //consumer used
InfoGetResponse StarttoGet( 1: InfoGetRequest req) //consumer used
//zkserver used this rpc to request broker server
PrepareAcceptResponse PrepareAccept( 1: PrepareAcceptRequest req)
CloseAcceptResponse CloseAccept( 1: CloseAcceptRequest req)
PrepareSendResponse PrepareSend( 1: PrepareSendRequest req)
PrepareStateResponse PrepareState( 1: PrepareStateRequest req)
AddRaftPartitionResponse AddRaftPartition( 1: AddRaftPartitionRequest req)
CloseRaftPartitionResponse CloseRaftPartition( 1: CloseRaftPartitionRequest req)
AddFetchPartitionResponse AddFetchPartition( 1: AddFetchPartitionRequest req)
CloseFetchPartitionResponse CloseFetchPartition(1: CloseFetchPartitionRequest req)
}
//broker server 将信息发送到zkserver, zkserver连接上broker server
struct BroInfoRequest {
1: string broker_name
2: string broker_host_port
}
struct BroInfoResponse {
1: bool ret
}
//broker 请求恢复缓存信息
struct BroGetConfigRequest {
1: binary propertyinfo
}
struct BroGetConfigResponse {
1: bool ret
2: binary brokerinfo
}
//producer 请求zkserver信息该发送到那个broker上
struct ProGetBrokRequest {
1: string topic_name
2: string part_name
}
struct ProGetBrokResponse {
1: bool ret
2: string broker_host_port
3: string Err
}
//consumer 请求zkserver
struct ConStartGetBrokRequest {
1: string cli_name
2: string topic_name
3: string part_name
4: i8 option
5: i64 index
}
//返回brokers
struct ConStartGetBrokResponse {
1: bool ret
2: i64 size
3: binary parts
// 3: binary broks
}
struct CreateTopicRequest {
1: string topic_name
}
struct CreateTopicResponse {
1: bool ret
2: string err
}
struct CreatePartRequest {
1: string topic_name
2: string part_name
}
struct CreatePartResponse {
1: bool ret
2: string err
}
//consumer订阅topic或partition,由zkserver处理
struct SubRequest {
1: string consumer
2: string topic
3: string key
4: i8 option
}
struct SubResponse {
1: bool ret
}
struct UpdatePTPOffsetRequest{
1: string topic
2: string part
3: i64 offset
}
struct UpdatePTPOffsetResponse{
1: bool ret
}
struct UpdateDupRequest{
1: string topic
2: string part
3: string BrokerName
4: string BlockName
5: i64 EndIndex
6: bool leader
}
struct UpdateDupResponse{
1: bool ret
}
struct SetPartitionStateRequest{
1: string topic
2: string partition
3: i8 option
4: i8 dupnum
}
struct SetPartitionStateResponse{
1: bool ret
2: string err
}
struct BecomeLeaderRequest {
1: string Broker
2: string Topic
3: string Partition
}
struct BecomeLeaderResponse {
1: bool ret
}
struct GetNewLeaderRequest {
1: string TopicName
2: string PartName
3: string BlockName
}
struct GetNewLeaderResponse {
1: bool Ret
2: string LeaderBroker
3: string HostPort
}
service ZkServer_Operations {
//producer和consumer
SubResponse Sub( 1: SubRequest req) //consumer used
CreateTopicResponse CreateTopic( 1: CreateTopicRequest req)
CreatePartResponse CreatePart( 1: CreatePartRequest req)
ProGetBrokResponse ProGetBroker( 1: ProGetBrokRequest req)
SetPartitionStateResponse SetPartitionState( 1: SetPartitionStateRequest req)
ConStartGetBrokResponse ConStartGetBroker( 1: ConStartGetBrokRequest req)
//broker
BroInfoResponse BroInfo( 1: BroInfoRequest req) //broker 发送info让zkserver连接broker
//broker更新topic-partition的offset
UpdatePTPOffsetResponse UpdatePTPOffset( 1: UpdatePTPOffsetRequest req)
UpdateDupResponse UpdateDup(1: UpdateDupRequest req)
//broker成为新的leader
BecomeLeaderResponse BecomeLeader( 1: BecomeLeaderRequest req)
//broker获取新的Leader
GetNewLeaderResponse GetNewLeader( 1: GetNewLeaderRequest req)
//broker用于恢复缓存的,暂时不使用
BroGetConfigResponse BroGetConfig( 1: BroGetConfigRequest req)
}
struct PubRequest{
1: string topic_name
2: string part_name
3: i64 start_index
4: i64 end_index
5: binary msg
}
struct PubResponse{
1: bool ret
}
struct PingPongRequest {
1: bool ping
}
struct PingPongResponse{
1: bool pong
}
service Client_Operations {
PubResponse pub( 1: PubRequest req)
PingPongResponse pingpong( 1: PingPongRequest req)
}