delete_groups_request.go 876 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package sarama
  2. type DeleteGroupsRequest struct {
  3. Version int16
  4. Groups []string
  5. }
  6. func (r *DeleteGroupsRequest) encode(pe packetEncoder) error {
  7. return pe.putStringArray(r.Groups)
  8. }
  9. func (r *DeleteGroupsRequest) decode(pd packetDecoder, version int16) (err error) {
  10. r.Groups, err = pd.getStringArray()
  11. return
  12. }
  13. func (r *DeleteGroupsRequest) key() int16 {
  14. return 42
  15. }
  16. func (r *DeleteGroupsRequest) version() int16 {
  17. return r.Version
  18. }
  19. func (r *DeleteGroupsRequest) headerVersion() int16 {
  20. return 1
  21. }
  22. func (r *DeleteGroupsRequest) isValidVersion() bool {
  23. return r.Version >= 0 && r.Version <= 1
  24. }
  25. func (r *DeleteGroupsRequest) requiredVersion() KafkaVersion {
  26. switch r.Version {
  27. case 1:
  28. return V2_0_0_0
  29. case 0:
  30. return V1_1_0_0
  31. default:
  32. return V2_0_0_0
  33. }
  34. }
  35. func (r *DeleteGroupsRequest) AddGroup(group string) {
  36. r.Groups = append(r.Groups, group)
  37. }