endtxn.go 1019 B

1234567891011121314151617181920212223242526272829303132333435
  1. package endtxn
  2. import "github.com/segmentio/kafka-go/protocol"
  3. func init() {
  4. protocol.Register(&Request{}, &Response{})
  5. }
  6. type Request struct {
  7. // We need at least one tagged field to indicate that this is a "flexible" message
  8. // type.
  9. _ struct{} `kafka:"min=v3,max=v3,tag"`
  10. TransactionalID string `kafka:"min=v0,max=v2|min=v3,max=v3,compact"`
  11. ProducerID int64 `kafka:"min=v0,max=v3"`
  12. ProducerEpoch int16 `kafka:"min=v0,max=v3"`
  13. Committed bool `kafka:"min=v0,max=v3"`
  14. }
  15. func (r *Request) ApiKey() protocol.ApiKey { return protocol.EndTxn }
  16. func (r *Request) Transaction() string { return r.TransactionalID }
  17. var _ protocol.TransactionalMessage = (*Request)(nil)
  18. type Response struct {
  19. // We need at least one tagged field to indicate that this is a "flexible" message
  20. // type.
  21. _ struct{} `kafka:"min=v3,max=v3,tag"`
  22. ThrottleTimeMs int32 `kafka:"min=v0,max=v3"`
  23. ErrorCode int16 `kafka:"min=v0,max=v3"`
  24. }
  25. func (r *Response) ApiKey() protocol.ApiKey { return protocol.EndTxn }