gRPC migration update
Change-Id: Icdd1a824948fa994cd36bd121c962f5ecf74e3cf
diff --git a/vendor/github.com/Shopify/sarama/real_encoder.go b/vendor/github.com/Shopify/sarama/real_encoder.go
index 3c75387..c07204c 100644
--- a/vendor/github.com/Shopify/sarama/real_encoder.go
+++ b/vendor/github.com/Shopify/sarama/real_encoder.go
@@ -2,6 +2,7 @@
import (
"encoding/binary"
+ "errors"
"github.com/rcrowley/go-metrics"
)
@@ -39,11 +40,20 @@
re.off += binary.PutVarint(re.raw[re.off:], in)
}
+func (re *realEncoder) putUVarint(in uint64) {
+ re.off += binary.PutUvarint(re.raw[re.off:], in)
+}
+
func (re *realEncoder) putArrayLength(in int) error {
re.putInt32(int32(in))
return nil
}
+func (re *realEncoder) putCompactArrayLength(in int) {
+ // 0 represents a null array, so +1 has to be added
+ re.putUVarint(uint64(in + 1))
+}
+
func (re *realEncoder) putBool(in bool) {
if in {
re.putInt8(1)
@@ -78,6 +88,24 @@
return re.putRawBytes(in)
}
+func (re *realEncoder) putCompactBytes(in []byte) error {
+ re.putUVarint(uint64(len(in) + 1))
+ return re.putRawBytes(in)
+}
+
+func (re *realEncoder) putCompactString(in string) error {
+ re.putCompactArrayLength(len(in))
+ return re.putRawBytes([]byte(in))
+}
+
+func (re *realEncoder) putNullableCompactString(in *string) error {
+ if in == nil {
+ re.putInt8(0)
+ return nil
+ }
+ return re.putCompactString(*in)
+}
+
func (re *realEncoder) putString(in string) error {
re.putInt16(int16(len(in)))
copy(re.raw[re.off:], in)
@@ -108,6 +136,31 @@
return nil
}
+func (re *realEncoder) putCompactInt32Array(in []int32) error {
+ if in == nil {
+ return errors.New("expected int32 array to be non null")
+ }
+ // 0 represents a null array, so +1 has to be added
+ re.putUVarint(uint64(len(in)) + 1)
+ for _, val := range in {
+ re.putInt32(val)
+ }
+ return nil
+}
+
+func (re *realEncoder) putNullableCompactInt32Array(in []int32) error {
+ if in == nil {
+ re.putUVarint(0)
+ return nil
+ }
+ // 0 represents a null array, so +1 has to be added
+ re.putUVarint(uint64(len(in)) + 1)
+ for _, val := range in {
+ re.putInt32(val)
+ }
+ return nil
+}
+
func (re *realEncoder) putInt32Array(in []int32) error {
err := re.putArrayLength(len(in))
if err != nil {
@@ -130,6 +183,10 @@
return nil
}
+func (re *realEncoder) putEmptyTaggedFieldArray() {
+ re.putUVarint(0)
+}
+
func (re *realEncoder) offset() int {
return re.off
}