sasl_handshake_request.go 618 B

12345678910111213141516171819202122232425262728293031323334
  1. package sarama
  2. type SaslHandshakeRequest struct {
  3. Mechanism string
  4. Version int16
  5. }
  6. func (r *SaslHandshakeRequest) encode(pe packetEncoder) error {
  7. if err := pe.putString(r.Mechanism); err != nil {
  8. return err
  9. }
  10. return nil
  11. }
  12. func (r *SaslHandshakeRequest) decode(pd packetDecoder, version int16) (err error) {
  13. if r.Mechanism, err = pd.getString(); err != nil {
  14. return err
  15. }
  16. return nil
  17. }
  18. func (r *SaslHandshakeRequest) key() int16 {
  19. return 17
  20. }
  21. func (r *SaslHandshakeRequest) version() int16 {
  22. return r.Version
  23. }
  24. func (r *SaslHandshakeRequest) requiredVersion() KafkaVersion {
  25. return V0_10_0_0
  26. }