syncgroup.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package syncgroup
  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=v4,max=v5,tag"`
  10. GroupID string `kafka:"min=v0,max=v3|min=v4,max=v5,compact"`
  11. GenerationID int32 `kafka:"min=v0,max=v5|min=v4,max=v5,compact"`
  12. MemberID string `kafka:"min=v0,max=v3|min=v4,max=v5,compact"`
  13. GroupInstanceID string `kafka:"min=v3,max=v3,nullable|min=v4,max=v5,nullable,compact"`
  14. ProtocolType string `kafka:"min=v5,max=v5"`
  15. ProtocolName string `kafka:"min=v5,max=v5"`
  16. Assignments []RequestAssignment `kafka:"min=v0,max=v5"`
  17. }
  18. type RequestAssignment struct {
  19. // We need at least one tagged field to indicate that this is a "flexible" message
  20. // type.
  21. _ struct{} `kafka:"min=v4,max=v5,tag"`
  22. MemberID string `kafka:"min=v0,max=v3|min=v4,max=v5,compact"`
  23. Assignment []byte `kafka:"min=v0,max=v3|min=v4,max=v5,compact"`
  24. }
  25. func (r *Request) ApiKey() protocol.ApiKey { return protocol.SyncGroup }
  26. func (r *Request) Group() string { return r.GroupID }
  27. var _ protocol.GroupMessage = (*Request)(nil)
  28. type Response struct {
  29. // We need at least one tagged field to indicate that this is a "flexible" message
  30. // type.
  31. _ struct{} `kafka:"min=v4,max=v5,tag"`
  32. ThrottleTimeMS int32 `kafka:"min=v1,max=v5"`
  33. ErrorCode int16 `kafka:"min=v0,max=v5"`
  34. ProtocolType string `kafka:"min=v5,max=v5"`
  35. ProtocolName string `kafka:"min=v5,max=v5"`
  36. Assignments []byte `kafka:"min=v0,max=v3|min=v4,max=v5,compact"`
  37. }
  38. func (r *Response) ApiKey() protocol.ApiKey { return protocol.SyncGroup }