(r *bufio.Reader, size int)
| 367 | } |
| 368 | |
| 369 | func readFetchResponseHeaderV5(r *bufio.Reader, size int) (throttle int32, watermark int64, remain int, err error) { |
| 370 | var n int32 |
| 371 | type AbortedTransaction struct { |
| 372 | ProducerId int64 |
| 373 | FirstOffset int64 |
| 374 | } |
| 375 | var p struct { |
| 376 | Partition int32 |
| 377 | ErrorCode int16 |
| 378 | HighwaterMarkOffset int64 |
| 379 | LastStableOffset int64 |
| 380 | LogStartOffset int64 |
| 381 | } |
| 382 | var messageSetSize int32 |
| 383 | var abortedTransactions []AbortedTransaction |
| 384 | |
| 385 | if remain, err = readInt32(r, size, &throttle); err != nil { |
| 386 | return |
| 387 | } |
| 388 | |
| 389 | if remain, err = readInt32(r, remain, &n); err != nil { |
| 390 | return |
| 391 | } |
| 392 | |
| 393 | // This error should never trigger, unless there's a bug in the kafka client |
| 394 | // or server. |
| 395 | if n != 1 { |
| 396 | err = fmt.Errorf("1 kafka topic was expected in the fetch response but the client received %d", n) |
| 397 | return |
| 398 | } |
| 399 | |
| 400 | // We ignore the topic name because we've requests messages for a single |
| 401 | // topic, unless there's a bug in the kafka server we will have received |
| 402 | // the name of the topic that we requested. |
| 403 | if remain, err = discardString(r, remain); err != nil { |
| 404 | return |
| 405 | } |
| 406 | |
| 407 | if remain, err = readInt32(r, remain, &n); err != nil { |
| 408 | return |
| 409 | } |
| 410 | |
| 411 | // This error should never trigger, unless there's a bug in the kafka client |
| 412 | // or server. |
| 413 | if n != 1 { |
| 414 | err = fmt.Errorf("1 kafka partition was expected in the fetch response but the client received %d", n) |
| 415 | return |
| 416 | } |
| 417 | |
| 418 | if remain, err = read(r, remain, &p); err != nil { |
| 419 | return |
| 420 | } |
| 421 | |
| 422 | var abortedTransactionLen int |
| 423 | if remain, err = readArrayLen(r, remain, &abortedTransactionLen); err != nil { |
| 424 | return |
| 425 | } |
| 426 |
no test coverage detected