| 1 |
package addpartitionstotxn |
| 2 |
|
| 3 |
import "github.com/segmentio/kafka-go/protocol" |
| 4 |
|
| 5 |
func init() { |
| 6 |
protocol.Register(&Request{}, &Response{}) |
| 7 |
} |
| 8 |
|
| 9 |
type Request struct { |
| 10 |
// We need at least one tagged field to indicate that this is a "flexible" message |
| 11 |
// type. |
| 12 |
_ struct{} `kafka:"min=v3,max=v3,tag"` |
| 13 |
|
| 14 |
TransactionalID string `kafka:"min=v0,max=v2|min=v3,max=v3,compact"` |
| 15 |
ProducerID int64 `kafka:"min=v0,max=v3"` |
| 16 |
ProducerEpoch int16 `kafka:"min=v0,max=v3"` |
| 17 |
Topics []RequestTopic `kafka:"min=v0,max=v3"` |
| 18 |
} |
| 19 |
|
| 20 |
type RequestTopic struct { |
| 21 |
// We need at least one tagged field to indicate that this is a "flexible" message |
| 22 |
// type. |
| 23 |
_ struct{} `kafka:"min=v3,max=v3,tag"` |
| 24 |
|
| 25 |
Name string `kafka:"min=v0,max=v2|min=v3,max=v3,compact"` |
| 26 |
Partitions []int32 `kafka:"min=v0,max=v3"` |
| 27 |
} |
| 28 |
|
| 29 |
func (r *Request) ApiKey() protocol.ApiKey { return protocol.AddPartitionsToTxn } |
| 30 |
|
| 31 |
func (r *Request) Transaction() string { return r.TransactionalID } |
| 32 |
|
| 33 |
var _ protocol.TransactionalMessage = (*Request)(nil) |
| 34 |
|
| 35 |
type Response struct { |
| 36 |
// We need at least one tagged field to indicate that this is a "flexible" message |
| 37 |
// type. |
| 38 |
_ struct{} `kafka:"min=v3,max=v3,tag"` |
| 39 |
|
| 40 |
ThrottleTimeMs int32 `kafka:"min=v0,max=v3"` |
| 41 |
Results []ResponseResult `kafka:"min=v0,max=v3"` |
| 42 |
} |
| 43 |
|
| 44 |
type ResponseResult struct { |
| 45 |
// We need at least one tagged field to indicate that this is a "flexible" message |
| 46 |
// type. |
| 47 |
_ struct{} `kafka:"min=v3,max=v3,tag"` |
| 48 |
|
| 49 |
Name string `kafka:"min=v0,max=v2|min=v3,max=v3,compact"` |
| 50 |
Results []ResponsePartition `kafka:"min=v0,max=v3"` |
| 51 |
} |
| 52 |
|
| 53 |
type ResponsePartition struct { |
| 54 |
// We need at least one tagged field to indicate that this is a "flexible" message |
| 55 |
// type. |
| 56 |
_ struct{} `kafka:"min=v3,max=v3,tag"` |
| 57 |
|
| 58 |
PartitionIndex int32 `kafka:"min=v0,max=v3"` |
| 59 |
ErrorCode int16 `kafka:"min=v0,max=v3"` |
| 60 |
} |
| 61 |
|
| 62 |
func (r *Response) ApiKey() protocol.ApiKey { return protocol.AddPartitionsToTxn } |