|
|
@@ -8,7 +8,7 @@ import (
|
|
|
)
|
|
|
|
|
|
// CompressionCodec represents the various compression codecs recognized by Kafka in messages.
|
|
|
-type CompressionCodec int8
|
|
|
+type CompressionCodec uint8
|
|
|
|
|
|
const (
|
|
|
CompressionNone CompressionCodec = 0
|
|
|
@@ -33,7 +33,7 @@ func (m *Message) encode(pe packetEncoder) error {
|
|
|
|
|
|
pe.putInt8(messageFormat)
|
|
|
|
|
|
- attributes := int8(m.Codec) & 0x07
|
|
|
+ attributes := int8(m.Codec << 5)
|
|
|
pe.putInt8(attributes)
|
|
|
|
|
|
err := pe.putBytes(m.Key)
|
|
|
@@ -95,7 +95,7 @@ func (m *Message) decode(pd packetDecoder) (err error) {
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
- m.Codec = CompressionCodec(attribute & 0x07)
|
|
|
+ m.Codec = CompressionCodec(attribute >> 5)
|
|
|
|
|
|
m.Key, err = pd.getBytes()
|
|
|
if err != nil {
|