/
structs.go
985 lines (790 loc) · 31.1 KB
/
structs.go
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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
package kafka
import (
"time"
)
type RequiredAcks int16
const (
RequireNone RequiredAcks = 0
RequireOne RequiredAcks = 1
RequireAll RequiredAcks = -1
)
type UUID struct {
TimeLow int32 `json:"timeLow"`
TimeMid int16 `json:"timeMid"`
TimeHiAndVersion int16 `json:"timeHiAndVersion"`
ClockSeq int16 `json:"clockSeq"`
NodePart1 int32 `json:"nodePart1"`
NodePart22 int16 `json:"nodePart22"`
}
// Metadata Request (Version: 0)
type MetadataRequestTopicV0 struct {
Name string `json:"name"`
}
type MetadataRequestV0 struct {
Topics []MetadataRequestTopicV0 `json:"topics"`
}
// Metadata Request (Version: 4)
type MetadataRequestV4 struct {
Topics []MetadataRequestTopicV0 `json:"topics"`
AllowAutoTopicCreation bool `json:"allowAutoTopicCreation"`
}
// Metadata Request (Version: 8)
type MetadataRequestV8 struct {
Topics []MetadataRequestTopicV0 `json:"topics"`
AllowAutoTopicCreation bool `json:"allowAutoTopicCreation"`
IncludeClusterAuthorizedOperations bool `json:"includeClusterAuthorizedOperations"`
IncludeTopicAuthorizedOperations bool `json:"includeTopicAuthorizedOperations"`
}
// Metadata Request (Version: 10)
type MetadataRequestTopicV10 struct {
Name string
UUID UUID
}
type MetadataRequestV10 struct {
Topics []MetadataRequestTopicV10 `json:"topics"`
AllowAutoTopicCreation bool `json:"allowAutoTopicCreation"`
IncludeClusterAuthorizedOperations bool `json:"includeClusterAuthorizedOperations"`
IncludeTopicAuthorizedOperations bool `json:"includeTopicAuthorizedOperations"`
}
// Metadata Request (Version: 11)
type MetadataRequestV11 struct {
Topics []MetadataRequestTopicV10 `json:"topics"`
AllowAutoTopicCreation bool `json:"allowAutoTopicCreation"`
IncludeTopicAuthorizedOperations bool `json:"includeTopicAuthorizedOperations"`
}
// Metadata Response (Version: 0)
type BrokerV0 struct {
NodeId int32 `json:"nodeId"`
Host string `json:"host"`
Port int32 `json:"port"`
}
type PartitionsV0 struct {
ErrorCode int16 `json:"errorCode"`
PartitionIndex int32 `json:"partitionIndex"`
LeaderId int32 `json:"leaderId"`
ReplicaNodes int32 `json:"replicaNodes"`
IsrNodes int32 `json:"isrNodes"`
}
type TopicV0 struct {
ErrorCode int16 `json:"errorCode"`
Name string `json:"name"`
Partitions []PartitionsV0 `json:"partitions"`
}
type MetadataResponseV0 struct {
Brokers []BrokerV0 `json:"brokers"`
Topics []TopicV0 `json:"topics"`
}
// Metadata Response (Version: 1)
type BrokerV1 struct {
NodeId int32 `json:"nodeId"`
Host string `json:"host"`
Port int32 `json:"port"`
Rack string `json:"rack"`
}
type TopicV1 struct {
ErrorCode int16 `json:"errorCode"`
Name string `json:"name"`
IsInternal bool `json:"isInternal"`
Partitions []PartitionsV0 `json:"partitions"`
}
type MetadataResponseV1 struct {
Brokers []BrokerV1 `json:"brokers"`
ControllerID int32 `json:"controllerID"`
Topics []TopicV1 `json:"topics"`
}
// Metadata Response (Version: 2)
type MetadataResponseV2 struct {
Brokers []BrokerV1 `json:"brokers"`
ClusterID string `json:"clusterID"`
ControllerID int32 `json:"controllerID"`
Topics []TopicV1 `json:"topics"`
}
// Metadata Response (Version: 3)
type MetadataResponseV3 struct {
ThrottleTimeMs int32 `json:"throttleTimeMs"`
Brokers []BrokerV1 `json:"brokers"`
ClusterID string `json:"clusterID"`
ControllerID int32 `json:"controllerID"`
Topics []TopicV1 `json:"topics"`
}
// Metadata Response (Version: 5)
type PartitionsV5 struct {
ErrorCode int16 `json:"errorCode"`
PartitionIndex int32 `json:"partitionIndex"`
LeaderId int32 `json:"leaderId"`
ReplicaNodes int32 `json:"replicaNodes"`
IsrNodes int32 `json:"isrNodes"`
OfflineReplicas int32 `json:"offlineReplicas"`
}
type TopicV5 struct {
ErrorCode int16 `json:"errorCode"`
Name string `json:"name"`
IsInternal bool `json:"isInternal"`
Partitions []PartitionsV5 `json:"partitions"`
}
type MetadataResponseV5 struct {
ThrottleTimeMs int32 `json:"throttleTimeMs"`
Brokers []BrokerV1 `json:"brokers"`
ClusterID string `json:"clusterID"`
ControllerID int32 `json:"controllerID"`
Topics []TopicV5 `json:"topics"`
}
// Metadata Response (Version: 7)
type PartitionsV7 struct {
ErrorCode int16 `json:"errorCode"`
PartitionIndex int32 `json:"partitionIndex"`
LeaderId int32 `json:"leaderId"`
LeaderEpoch int32 `json:"leaderEpoch"`
ReplicaNodes int32 `json:"replicaNodes"`
IsrNodes int32 `json:"isrNodes"`
OfflineReplicas int32 `json:"offlineReplicas"`
}
type TopicV7 struct {
ErrorCode int16 `json:"errorCode"`
Name string `json:"name"`
IsInternal bool `json:"isInternal"`
Partitions []PartitionsV7 `json:"partitions"`
}
type MetadataResponseV7 struct {
ThrottleTimeMs int32 `json:"throttleTimeMs"`
Brokers []BrokerV1 `json:"brokers"`
ClusterID string `json:"clusterID"`
ControllerID int32 `json:"controllerID"`
Topics []TopicV7 `json:"topics"`
}
// Metadata Response (Version: 8)
type TopicV8 struct {
ErrorCode int16 `json:"errorCode"`
Name string `json:"name"`
IsInternal bool `json:"isInternal"`
Partitions []PartitionsV7 `json:"partitions"`
TopicAuthorizedOperations int32 `json:"topicAuthorizedOperations"`
}
type MetadataResponseV8 struct {
ThrottleTimeMs int32 `json:"throttleTimeMs"`
Brokers []BrokerV1 `json:"brokers"`
ClusterID string `json:"clusterID"`
ControllerID int32 `json:"controllerID"`
Topics []TopicV8 `json:"topics"`
ClusterAuthorizedOperations int32 `json:"clusterAuthorizedOperations"`
}
// Metadata Response (Version: 10)
type TopicV10 struct {
ErrorCode int16 `json:"errorCode"`
Name string `json:"name"`
TopicID UUID `json:"topicID"`
IsInternal bool `json:"isInternal"`
Partitions []PartitionsV7 `json:"partitions"`
TopicAuthorizedOperations int32 `json:"topicAuthorizedOperations"`
}
type MetadataResponseV10 struct {
ThrottleTimeMs int32 `json:"throttleTimeMs"`
Brokers []BrokerV1 `json:"brokers"`
ClusterID string `json:"clusterID"`
ControllerID int32 `json:"controllerID"`
Topics []TopicV10 `json:"topics"`
ClusterAuthorizedOperations int32 `json:"clusterAuthorizedOperations"`
}
// Metadata Response (Version: 11)
type MetadataResponseV11 struct {
ThrottleTimeMs int32 `json:"throttleTimeMs"`
Brokers []BrokerV1 `json:"brokers"`
ClusterID string `json:"clusterID"`
ControllerID int32 `json:"controllerID"`
Topics []TopicV10 `json:"topics"`
}
// ApiVersions Request (Version: 0)
type ApiVersionsRequestV0 struct{}
// ApiVersions Request (Version: 3)
type ApiVersionsRequestV3 struct {
ClientSoftwareName string `json:"clientSoftwareName"`
ClientSoftwareVersion string `json:"clientSoftwareVersion"`
}
// ApiVersions Response (Version: 0)
type ApiVersionsResponseApiKey struct {
ApiKey int16 `json:"apiKey"`
MinVersion int16 `json:"minVersion"`
MaxVersion int16 `json:"maxVersion"`
}
type ApiVersionsResponseV0 struct {
ErrorCode int16 `json:"errorCode"`
ApiKeys []ApiVersionsResponseApiKey `json:"apiKeys"`
}
// ApiVersions Response (Version: 1)
type ApiVersionsResponseV1 struct {
ErrorCode int16 `json:"errorCode"`
ApiKeys []ApiVersionsResponseApiKey `json:"apiKeys"` // FIXME: `confluent-kafka-python` causes memory leak
ThrottleTimeMs int32 `json:"throttleTimeMs"`
}
// Produce Request (Version: 0)
// Message is a kafka message type
type MessageV0 struct {
Codec int8 `json:"codec"` // codec used to compress the message contents
CompressionLevel int `json:"compressionLevel"` // compression level
LogAppendTime bool `json:"logAppendTime"` // the used timestamp is LogAppendTime
Key []byte `json:"key"` // the message key, may be nil
Value []byte `json:"value"` // the message contents
Set *MessageSet `json:"set"` // the message set a message might wrap
Version int8 `json:"version"` // v1 requires Kafka 0.10
Timestamp time.Time `json:"timestamp"` // the timestamp of the message (version 1+ only)
}
// MessageBlock represents a part of request with message
type MessageBlock struct {
Offset int64 `json:"offset"`
Msg *MessageV0 `json:"msg"`
}
// MessageSet is a replacement for RecordBatch in older versions
type MessageSet struct {
PartialTrailingMessage bool `json:"partialTrailingMessage"` // whether the set on the wire contained an incomplete trailing MessageBlock
OverflowMessage bool `json:"overflowMessage"` // whether the set on the wire contained an overflow message
Messages []*MessageBlock `json:"messages"`
}
type RecordHeader struct {
HeaderKeyLength int8 `json:"headerKeyLength"`
HeaderKey string `json:"headerKey"`
HeaderValueLength int8 `json:"headerValueLength"`
Value string `json:"value"`
}
// Record is kafka record type
type RecordV0 struct {
Unknown int8 `json:"unknown"`
Attributes int8 `json:"attributes"`
TimestampDelta int8 `json:"timestampDelta"`
OffsetDelta int8 `json:"offsetDelta"`
KeyLength int8 `json:"keyLength"`
Key string `json:"key"`
ValueLen int8 `json:"valueLen"`
Value string `json:"value"`
Headers []RecordHeader `json:"headers"`
}
// RecordBatch are records from one kafka request
type RecordBatch struct {
BaseOffset int64 `json:"baseOffset"`
BatchLength int32 `json:"batchLength"`
PartitionLeaderEpoch int32 `json:"partitionLeaderEpoch"`
Magic int8 `json:"magic"`
Crc int32 `json:"crc"`
Attributes int16 `json:"attributes"`
LastOffsetDelta int32 `json:"lastOffsetDelta"`
FirstTimestamp int64 `json:"firstTimestamp"`
MaxTimestamp int64 `json:"maxTimestamp"`
ProducerId int64 `json:"producerId"`
ProducerEpoch int16 `json:"producerEpoch"`
BaseSequence int32 `json:"baseSequence"`
Record []RecordV0 `json:"record"`
}
type Records struct {
RecordBatch RecordBatch `json:"recordBatch"`
// TODO: Implement `MessageSet`
// MessageSet MessageSet
}
type PartitionData struct {
Index int32 `json:"index"`
Unknown int32 `json:"unknown"`
Records Records `json:"records"`
}
type Partitions struct {
Length int32 `json:"length"`
PartitionData PartitionData `json:"partitionData"`
}
type TopicData struct {
Topic string `json:"topic"`
Partitions Partitions `json:"partitions"`
}
type ProduceRequestV0 struct {
RequiredAcks RequiredAcks `json:"requiredAcks"`
Timeout int32 `json:"timeout"`
TopicData []TopicData `json:"topicData"`
}
// Produce Request (Version: 3)
type ProduceRequestV3 struct {
TransactionalID string `json:"transactionalID"`
RequiredAcks RequiredAcks `json:"requiredAcks"`
Timeout int32 `json:"timeout"`
TopicData []TopicData `json:"topicData"`
}
// Produce Response (Version: 0)
type PartitionResponseV0 struct {
Index int32 `json:"index"`
ErrorCode int16 `json:"errorCode"`
BaseOffset int64 `json:"baseOffset"`
}
type ResponseV0 struct {
Name string `json:"name"`
PartitionResponses []PartitionResponseV0 `json:"partitionResponses"`
}
type ProduceResponseV0 struct {
Responses []ResponseV0 `json:"responses"`
}
// Produce Response (Version: 1)
type ProduceResponseV1 struct {
Responses []ResponseV0 `json:"responses"`
ThrottleTimeMs int32 `json:"throttleTimeMs"`
}
// Produce Response (Version: 2)
type PartitionResponseV2 struct {
Index int32 `json:"index"`
ErrorCode int16 `json:"errorCode"`
BaseOffset int64 `json:"baseOffset"`
LogAppendTimeMs int64 `json:"logAppendTimeMs"`
}
type ResponseV2 struct {
Name string `json:"name"`
PartitionResponses []PartitionResponseV2 `json:"partitionResponses"`
}
type ProduceResponseV2 struct {
Responses []ResponseV2 `json:"responses"`
ThrottleTimeMs int32 `json:"throttleTimeMs"`
}
// Produce Response (Version: 5)
type PartitionResponseV5 struct {
Index int32 `json:"index"`
ErrorCode int16 `json:"errorCode"`
BaseOffset int64 `json:"baseOffset"`
LogAppendTimeMs int64 `json:"logAppendTimeMs"`
LogStartOffset int64 `json:"logStartOffset"`
}
type ResponseV5 struct {
Name string `json:"name"`
PartitionResponses []PartitionResponseV5 `json:"partitionResponses"`
}
type ProduceResponseV5 struct {
Responses []ResponseV5 `json:"responses"`
ThrottleTimeMs int32 `json:"throttleTimeMs"`
}
// Produce Response (Version: 8)
type RecordErrors struct {
BatchIndex int32 `json:"batchIndex"`
BatchIndexErrorMessage string `json:"batchIndexErrorMessage"`
}
type PartitionResponseV8 struct {
Index int32 `json:"index"`
ErrorCode int16 `json:"errorCode"`
BaseOffset int64 `json:"baseOffset"`
LogAppendTimeMs int64 `json:"logAppendTimeMs"`
LogStartOffset int64 `json:"logStartOffset"`
RecordErrors RecordErrors `json:"recordErrors"`
ErrorMessage string `json:"errorMessage"`
}
type ResponseV8 struct {
Name string `json:"name"`
PartitionResponses []PartitionResponseV8 `json:"partitionResponses"`
}
type ProduceResponseV8 struct {
Responses []ResponseV8 `json:"responses"`
ThrottleTimeMs int32 `json:"throttleTimeMs"`
}
// Fetch Request (Version: 0)
type FetchPartitionV0 struct {
Partition int32 `json:"partition"`
FetchOffset int64 `json:"fetchOffset"`
PartitionMaxBytes int32 `json:"partitionMaxBytes"`
}
type FetchTopicV0 struct {
Topic string `json:"topic"`
Partitions []FetchPartitionV0 `json:"partitions"`
}
type FetchRequestV0 struct {
ReplicaId int32 `json:"replicaId"`
MaxWaitMs int32 `json:"maxWaitMs"`
MinBytes int32 `json:"minBytes"`
Topics []FetchTopicV0 `json:"topics"`
}
// Fetch Request (Version: 3)
type FetchRequestV3 struct {
ReplicaId int32 `json:"replicaId"`
MaxWaitMs int32 `json:"maxWaitMs"`
MinBytes int32 `json:"minBytes"`
MaxBytes int32 `json:"maxBytes"`
Topics []FetchTopicV0 `json:"topics"`
}
// Fetch Request (Version: 4)
type FetchRequestV4 struct {
ReplicaId int32 `json:"replicaId"`
MaxWaitMs int32 `json:"maxWaitMs"`
MinBytes int32 `json:"minBytes"`
MaxBytes int32 `json:"maxBytes"`
IsolationLevel int8 `json:"isolationLevel"`
Topics []FetchTopicV0 `json:"topics"`
}
// Fetch Request (Version: 5)
type FetchPartitionV5 struct {
Partition int32 `json:"partition"`
FetchOffset int64 `json:"fetchOffset"`
LogStartOffset int64 `json:"logStartOffset"`
PartitionMaxBytes int32 `json:"partitionMaxBytes"`
}
type FetchTopicV5 struct {
Topic string `json:"topic"`
Partitions []FetchPartitionV5 `json:"partitions"`
}
type FetchRequestV5 struct {
ReplicaId int32 `json:"replicaId"`
MaxWaitMs int32 `json:"maxWaitMs"`
MinBytes int32 `json:"minBytes"`
MaxBytes int32 `json:"maxBytes"`
IsolationLevel int8 `json:"isolationLevel"`
Topics []FetchTopicV5 `json:"topics"`
}
// Fetch Request (Version: 7)
type ForgottenTopicsDataV7 struct {
Topic string `json:"topic"`
Partitions []int32 `json:"partitions"`
}
type FetchRequestV7 struct {
ReplicaId int32 `json:"replicaId"`
MaxWaitMs int32 `json:"maxWaitMs"`
MinBytes int32 `json:"minBytes"`
MaxBytes int32 `json:"maxBytes"`
IsolationLevel int8 `json:"isolationLevel"`
SessionId int32 `json:"sessionId"`
SessionEpoch int32 `json:"sessionEpoch"`
Topics []FetchTopicV5 `json:"topics"`
ForgottenTopicsData ForgottenTopicsDataV7 `json:"forgottenTopicsData"`
}
// Fetch Request (Version: 9)
type FetchPartitionV9 struct {
Partition int32 `json:"partition"`
CurrentLeaderEpoch int32 `json:"currentLeaderEpoch"`
FetchOffset int64 `json:"fetchOffset"`
LogStartOffset int64 `json:"logStartOffset"`
PartitionMaxBytes int32 `json:"partitionMaxBytes"`
}
type FetchTopicV9 struct {
Topic string `json:"topic"`
Partitions []FetchPartitionV9 `json:"partitions"`
}
type FetchRequestV9 struct {
ReplicaId int32 `json:"replicaId"`
MaxWaitMs int32 `json:"maxWaitMs"`
MinBytes int32 `json:"minBytes"`
MaxBytes int32 `json:"maxBytes"`
IsolationLevel int8 `json:"isolationLevel"`
SessionId int32 `json:"sessionId"`
SessionEpoch int32 `json:"sessionEpoch"`
Topics []FetchTopicV9 `json:"topics"`
ForgottenTopicsData ForgottenTopicsDataV7 `json:"forgottenTopicsData"`
}
// Fetch Request (Version: 11)
type FetchRequestV11 struct {
ReplicaId int32 `json:"replicaId"`
MaxWaitMs int32 `json:"maxWaitMs"`
MinBytes int32 `json:"minBytes"`
MaxBytes int32 `json:"maxBytes"`
IsolationLevel int8 `json:"isolationLevel"`
SessionId int32 `json:"sessionId"`
SessionEpoch int32 `json:"sessionEpoch"`
Topics []FetchTopicV9 `json:"topics"`
ForgottenTopicsData ForgottenTopicsDataV7 `json:"forgottenTopicsData"`
RackId string `json:"rackId"`
}
// Fetch Response (Version: 0)
type PartitionResponseFetchV0 struct {
Partition int32 `json:"partition"`
ErrorCode int16 `json:"errorCode"`
HighWatermark int64 `json:"highWatermark"`
RecordSet Records `json:"recordSet"`
}
type ResponseFetchV0 struct {
Topic string `json:"topic"`
PartitionResponses []PartitionResponseFetchV0 `json:"partitionResponses"`
}
type FetchResponseV0 struct {
Responses []ResponseFetchV0 `json:"responses"`
}
// Fetch Response (Version: 1)
type FetchResponseV1 struct {
ThrottleTimeMs int32 `json:"throttleTimeMs"`
Responses []ResponseFetchV0 `json:"responses"`
}
// Fetch Response (Version: 4)
type AbortedTransactionsV4 struct {
ProducerId int32 `json:"producerId"`
FirstOffset int32 `json:"firstOffset"`
}
type PartitionResponseFetchV4 struct {
Partition int32 `json:"partition"`
ErrorCode int16 `json:"errorCode"`
HighWatermark int64 `json:"highWatermark"`
LastStableOffset int64 `json:"lastStableOffset"`
AbortedTransactions AbortedTransactionsV4 `json:"abortedTransactions"`
RecordSet Records `json:"recordSet"`
}
type ResponseFetchV4 struct {
Topic string `json:"topic"`
PartitionResponses []PartitionResponseFetchV4 `json:"partitionResponses"`
}
type FetchResponseV4 struct {
ThrottleTimeMs int32 `json:"throttleTimeMs"`
Responses []ResponseFetchV4 `json:"responses"`
}
// Fetch Response (Version: 5)
type PartitionResponseFetchV5 struct {
Partition int32 `json:"partition"`
ErrorCode int16 `json:"errorCode"`
HighWatermark int64 `json:"highWatermark"`
LastStableOffset int64 `json:"lastStableOffset"`
LogStartOffset int64 `json:"logStartOffset"`
AbortedTransactions AbortedTransactionsV4 `json:"abortedTransactions"`
RecordSet Records `json:"recordSet"`
}
type ResponseFetchV5 struct {
Topic string `json:"topic"`
PartitionResponses []PartitionResponseFetchV5 `json:"partitionResponses"`
}
type FetchResponseV5 struct {
ThrottleTimeMs int32 `json:"throttleTimeMs"`
Responses []ResponseFetchV5 `json:"responses"`
}
// Fetch Response (Version: 7)
type FetchResponseV7 struct {
ThrottleTimeMs int32 `json:"throttleTimeMs"`
ErrorCode int16 `json:"errorCode"`
SessionId int32 `json:"sessionId"`
Responses []ResponseFetchV5 `json:"responses"`
}
// Fetch Response (Version: 11)
type PartitionResponseFetchV11 struct {
Partition int32 `json:"partition"`
ErrorCode int16 `json:"errorCode"`
HighWatermark int64 `json:"highWatermark"`
LastStableOffset int64 `json:"lastStableOffset"`
LogStartOffset int64 `json:"logStartOffset"`
AbortedTransactions AbortedTransactionsV4 `json:"abortedTransactions"`
PreferredReadReplica int32 `json:"preferredReadReplica"`
RecordSet Records `json:"recordSet"`
}
type ResponseFetchV11 struct {
Topic string `json:"topic"`
PartitionResponses []PartitionResponseFetchV11 `json:"partitionResponses"`
}
type FetchResponseV11 struct {
ThrottleTimeMs int32 `json:"throttleTimeMs"`
ErrorCode int16 `json:"errorCode"`
SessionId int32 `json:"sessionId"`
Responses []ResponseFetchV5 `json:"responses"`
}
// ListOffsets Request (Version: 0)
type ListOffsetsRequestPartitionV0 struct {
PartitionIndex int32 `json:"partitionIndex"`
Timestamp int64 `json:"timestamp"`
MaxNumOffsets int32 `json:"maxNumOffsets"`
}
type ListOffsetsRequestTopicV0 struct {
Name string `json:"name"`
Partitions []ListOffsetsRequestPartitionV0 `json:"partitions"`
}
type ListOffsetsRequestV0 struct {
ReplicaId int32 `json:"replicaId"`
Topics []ListOffsetsRequestTopicV0 `json:"topics"`
}
// ListOffsets Request (Version: 1)
type ListOffsetsRequestPartitionV1 struct {
PartitionIndex int32 `json:"partitionIndex"`
Timestamp int64 `json:"timestamp"`
}
type ListOffsetsRequestTopicV1 struct {
Name string `json:"name"`
Partitions []ListOffsetsRequestPartitionV1 `json:"partitions"`
}
type ListOffsetsRequestV1 struct {
ReplicaId int32 `json:"replicaId"`
Topics []ListOffsetsRequestTopicV1 `json:"topics"`
}
// ListOffsets Request (Version: 2)
type ListOffsetsRequestV2 struct {
ReplicaId int32 `json:"replicaId"`
IsolationLevel int8 `json:"isolationLevel"`
Topics []ListOffsetsRequestTopicV1 `json:"topics"`
}
// ListOffsets Request (Version: 4)
type ListOffsetsRequestPartitionV4 struct {
PartitionIndex int32 `json:"partitionIndex"`
CurrentLeaderEpoch int32 `json:"currentLeaderEpoch"`
Timestamp int64 `json:"timestamp"`
}
type ListOffsetsRequestTopicV4 struct {
Name string `json:"name"`
Partitions []ListOffsetsRequestPartitionV4 `json:"partitions"`
}
type ListOffsetsRequestV4 struct {
ReplicaId int32 `json:"replicaId"`
Topics []ListOffsetsRequestTopicV4 `json:"topics"`
}
// ListOffsets Response (Version: 0)
type ListOffsetsResponsePartitionV0 struct {
PartitionIndex int32 `json:"partitionIndex"`
ErrorCode int16 `json:"errorCode"`
OldStyleOffsets int64 `json:"oldStyleOffsets"`
}
type ListOffsetsResponseTopicV0 struct {
Name string `json:"name"`
Partitions []ListOffsetsResponsePartitionV0 `json:"partitions"`
}
type ListOffsetsResponseV0 struct {
Topics []ListOffsetsResponseTopicV0 `json:"topics"`
}
// ListOffsets Response (Version: 1)
type ListOffsetsResponsePartitionV1 struct {
PartitionIndex int32 `json:"partitionIndex"`
ErrorCode int16 `json:"errorCode"`
Timestamp int64 `json:"timestamp"`
Offset int64 `json:"offset"`
}
type ListOffsetsResponseTopicV1 struct {
Name string `json:"name"`
Partitions []ListOffsetsResponsePartitionV1 `json:"partitions"`
}
type ListOffsetsResponseV1 struct {
Topics []ListOffsetsResponseTopicV1 `json:"topics"`
}
// ListOffsets Response (Version: 2)
type ListOffsetsResponseV2 struct {
ThrottleTimeMs int32 `json:"throttleTimeMs"`
Topics []ListOffsetsResponseTopicV1 `json:"topics"`
}
// ListOffsets Response (Version: 4)
type ListOffsetsResponsePartitionV4 struct {
PartitionIndex int32 `json:"partitionIndex"`
ErrorCode int16 `json:"errorCode"`
Timestamp int64 `json:"timestamp"`
Offset int64 `json:"offset"`
LeaderEpoch int32 `json:"leaderEpoch"`
}
type ListOffsetsResponseTopicV4 struct {
Name string `json:"name"`
Partitions []ListOffsetsResponsePartitionV4 `json:"partitions"`
}
type ListOffsetsResponseV4 struct {
Topics []ListOffsetsResponseTopicV4 `json:"topics"`
}
// CreateTopics Request (Version: 0)
type AssignmentsV0 struct {
PartitionIndex int32 `json:"partitionIndex"`
BrokerIds []int32 `json:"brokerIds"`
}
type CreateTopicsRequestConfigsV0 struct {
Name string `json:"name"`
Value string `json:"value"`
}
type CreateTopicsRequestTopicV0 struct {
Name string `json:"name"`
NumPartitions int32 `json:"numPartitions"`
ReplicationFactor int16 `json:"replicationFactor"`
Assignments []AssignmentsV0 `json:"assignments"`
Configs []CreateTopicsRequestConfigsV0 `json:"configs"`
}
type CreateTopicsRequestV0 struct {
Topics []CreateTopicsRequestTopicV0 `json:"topics"`
TimeoutMs int32 `json:"timeoutMs"`
}
// CreateTopics Request (Version: 1)
type CreateTopicsRequestV1 struct {
Topics []CreateTopicsRequestTopicV0 `json:"topics"`
TimeoutMs int32 `json:"timeoutMs"`
ValidateOnly bool `json:"validateOnly"`
}
// CreateTopics Response (Version: 0)
type CreateTopicsResponseTopicV0 struct {
Name string `json:"name"`
ErrorCode int16 `json:"errorCode"`
}
type CreateTopicsResponseV0 struct {
Topics []CreateTopicsResponseTopicV0 `json:"topics"`
}
// CreateTopics Response (Version: 1)
type CreateTopicsResponseTopicV1 struct {
Name string `json:"name"`
ErrorCode int16 `json:"errorCode"`
ErrorMessage string `json:"errorMessage"`
}
type CreateTopicsResponseV1 struct {
Topics []CreateTopicsResponseTopicV1 `json:"topics"`
}
// CreateTopics Response (Version: 2)
type CreateTopicsResponseV2 struct {
ThrottleTimeMs int32 `json:"throttleTimeMs"`
Topics []CreateTopicsResponseTopicV1 `json:"topics"`
}
// CreateTopics Response (Version: 5)
type CreateTopicsResponseConfigsV5 struct {
Name string `json:"name"`
Value string `json:"value"`
ReadOnly bool `json:"readOnly"`
ConfigSource int8 `json:"configSource"`
IsSensitive bool `json:"isSensitive"`
}
type CreateTopicsResponseTopicV5 struct {
Name string `json:"name"`
ErrorCode int16 `json:"errorCode"`
ErrorMessage string `json:"errorMessage"`
NumPartitions int32 `json:"numPartitions"`
ReplicationFactor int16 `json:"replicationFactor"`
Configs []CreateTopicsResponseConfigsV5 `json:"configs"`
}
type CreateTopicsResponseV5 struct {
ThrottleTimeMs int32 `json:"throttleTimeMs"`
Topics []CreateTopicsResponseTopicV5 `json:"topics"`
}
// CreateTopics Response (Version: 7)
type CreateTopicsResponseTopicV7 struct {
Name string `json:"name"`
TopicID UUID `json:"topicID"`
ErrorCode int16 `json:"errorCode"`
ErrorMessage string `json:"errorMessage"`
NumPartitions int32 `json:"numPartitions"`
ReplicationFactor int16 `json:"replicationFactor"`
Configs []CreateTopicsResponseConfigsV5 `json:"configs"`
}
type CreateTopicsResponseV7 struct {
ThrottleTimeMs int32 `json:"throttleTimeMs"`
Topics []CreateTopicsResponseTopicV7 `json:"topics"`
}
// DeleteTopics Request (Version: 0)
type DeleteTopicsRequestV0 struct {
TopicNames []string `json:"topicNames"`
TimeoutMs int32 `json:"timeoutMs"`
}
// DeleteTopics Request (Version: 6)
type DeleteTopicsRequestTopicV6 struct {
Name string `json:"name"`
UUID UUID `json:"uuid"`
}
type DeleteTopicsRequestV6 struct {
Topics []DeleteTopicsRequestTopicV6 `json:"topics"`
TimeoutMs int32 `json:"timeoutMs"`
}
// DeleteTopics Response (Version: 0)
type DeleteTopicsReponseResponseV0 struct {
Name string `json:"name"`
ErrorCode int16 `json:"errorCode"`
}
type DeleteTopicsReponseV0 struct {
Responses []DeleteTopicsReponseResponseV0 `json:"responses"`
}
// DeleteTopics Response (Version: 1)
type DeleteTopicsReponseV1 struct {
ThrottleTimeMs int32 `json:"throttleTimeMs"`
Responses []DeleteTopicsReponseResponseV0 `json:"responses"`
}
// DeleteTopics Response (Version: 5)
type DeleteTopicsReponseResponseV5 struct {
Name string `json:"name"`
ErrorCode int16 `json:"errorCode"`
ErrorMessage string `json:"errorMessage"`
}
type DeleteTopicsReponseV5 struct {
ThrottleTimeMs int32 `json:"throttleTimeMs"`
Responses []DeleteTopicsReponseResponseV5 `json:"responses"`
}
// DeleteTopics Response (Version: 6)
type DeleteTopicsReponseResponseV6 struct {
Name string `json:"name"`
TopicID UUID `json:"topicID"`
ErrorCode int16 `json:"errorCode"`
ErrorMessage string `json:"errorMessage"`
}
type DeleteTopicsReponseV6 struct {
ThrottleTimeMs int32 `json:"throttleTimeMs"`
Responses []DeleteTopicsReponseResponseV6 `json:"responses"`
}